Tobias DiPasquale on 26 Apr 2004 23:22:01 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] #define for 32 vs 64 bit C program?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 26 April 2004 16:43, Walt Mankowski wrote:
| I have a C app that was developed on a 32 bit Linux box, and I'm
| trying to get it to compile cleanly on a 64 bit opteron.  Does anyone
| know of a gcc preprocessor directive that will tell whether a source
| file is being compiled for 32 or 64 bits?

An unsigned long is the size of a platform's word.

#define IS_32_BIT	(sizeof( unsigned long) == 4)
#define IS_64_BIT	(sizeof( unsigned long) == 8)

- -- 
Tobias DiPasquale
202A 04C4 2CE6 B985 8520  88D6 CD25 1A6C B9B5 1595
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAjZlCzSUabLm1FZURAoneAJ9vpOsyI1YmwWLZ8yvtXajQrmf7ywCdGybv
/2/slgcIcFFXcxdSbW+aUFY=
=mZcQ
-----END PGP SIGNATURE-----
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug