Reputation: 38907
Is there a gcc macro that allows me to identify whether something is being compiled in 64bit mode?
Upvotes: 2
Views: 5536
Reputation: 765
Duplicate Question: Is there a GCC preprocessor directive to check if the code is being compiled on a 64 bit machine?
__LP64__
Seems to be what you want.
Upvotes: 3
Reputation: 1
And you could also, at least on Linux,
#include <features.h>
#include <endian.h> // perhaps you skip that
#include <limits.h>
#include <stdint.h>
Then <bits/workdsize.h>
gets included and gives you __WORDSIZE
(either 64 or 32)
But why do you ask and why using the standard types provided by <stdint.h>
is not enough for you?
Upvotes: 2