Re: How to find out if an architecture is 32 or 64 bit?
Adrian Bunk <bunk@fs.tum.de> writes:
> I'm lookking for my package tmview for a C solution to determine whether
> an architecture is 32 or 64 bit.
The correct answer is: your code shouldn't care. Very few programs
really need to make a distinction here.
> The current code is:
>
> <-- snip -->
>
> #define BMLONG32 /* for architectures where "long int" has 32bits,
> e.g. i386 */
> /* #define BMLONG64 *//* for architectures where "long int" has 64bits,
> e.g. alpha */
>
> Could anyone point me to a better way to handle this?
You could check if LONG_MAX from limits.h is 9223372036854775807L or
2147483647L, and barf it is isn't any.
Falk
Reply to: