This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
#define a phrase to be replaced by a single word
- From: Sisyphus <kalinabears at iinet dot net dot au>
- To: gcc <gcc-help at gcc dot gnu dot org>
- Date: Sat, 20 Nov 2004 23:37:15 +0000
- Subject: #define a phrase to be replaced by a single word
Hi,
I use MinGW (gcc) compiler on Win32.
It allows me to declare the 64-bit integer type 'long long'.
However, if I then try to build the same code using a Microsoft
compiler, the compilation fails because 'long long' is deemed illegal.
Instead I have to declare the 64-bit integer type as '_int64'.
To make the code portable across both compilers I tried the following
preprocessor directives:
#ifdef _MSC_VER
#define long long _int64
#endif
But, of course, that results in 'long' being replaced by 'long _int64'.
How do I make my intention clear to the preprocessor - ie that I want to
replace the phrase 'long long' with the single term '_int64' ?
I've looked in books, and in the comp.lang.c FAQ, and I can't find an
answer anywhere .... I'm starting to wonder if it can be done at all.
Cheers,
Rob