Boost logo

Boost :

Subject: [boost] Detection of 64bit using macro
From: Kim Kuen Tang (kuentang_at_[hidden])
Date: 2010-08-13 15:44:49


Hi all,

the question might be not directly related to boost. But i just want to
be sure that i am not reventing the wheel.
I am searching for a macro that is able to detect that a system is 32bit
or 64bit no matter what compiler is used.
Is there something similar already implemented in boost?

Perhaps some background about this feature.

Template specialization for std::size_t is not needed, when the
specialization already exists for unsigned int. But on a 64bit system
this is not true.
So you need explicitly added the specialization whenever a 64bit
compiler is used.

See the following example.

# include <cstddef>

template<typename T>
struct Null;

template<> struct Null<unsigned int> {};
template<> struct Null<std::size_t> {}; // compile only on a 64bit compiler

int main()
{
    return 0;
};

Thx for any comments, help or suggestions

Kim


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk