IA64 implies itanium which is irrelevant to your question.
You might test for _LP64 or perhaps _LLP64 but this approach to 64 bit
programming is misguided.
You don't need a macro.
Instead you can write something like this
int myfunc()
{
if(sizeof(void *) == 8)
take_64bit_path();
else if (sizeof(void *) == 4)
take_32_bit_path();
.....
}
An optimizing C compiler will generate code for only the
right branch and eliminated dead code for the other branches.
Similarly, some developers rely on header files (macros) to determine
CPU endianness. This is misguided too.
One could write this static inline function which compilers
like gcc turn into a constant (unfortunately there are certain
older compilers which can't do that (e.g. sun forte)!).
static int endian()
{
int x = 0x12345678;
unsigned char *y = &x;
if(y[0] == 0x12 && y[1] == 0x34 && y[2] == 0x56 && y[3] == 0x78)
return 1; /* big endian */
else if (......)
return 2; /* little endian */
else if (.....)
.... etc.... /* whatever else */
}
--- In ocaml_beginners%40yahoogroups.com">ocaml_beginners
yahoogroups.com, Florent Monnier <fmonnier
...>
wrote:
>
> Hi,
> Is there a macro from <caml/config.h> (or from stdlib.h) that can be
used to
> check if the architecture is a 64 bits or a 32 bits ?
> thanks
>
.