\"\" said:
Well, I hope there is a better way.
I think that even a 64 bit machine could use 32 bit registers for
unsigned int.
In 64 bit machines, I would like to use 64 bit data types.
Since I have to to AND and OR operation between bitsets, I think there
is a
good point in using 64 bits when available.
Is it possible that there is no way to get if I am compiling under a
64 bit machine?
(Please find a way to format your paragraphs more sanely. The jagged
lines are difficult to read.)
What exactly is a "64 bit machine"? If you can rigorously define the
term (I can't), then you can probably figure out a way to determine
whether you're on one.
My best suggestion: Look at a variety of systems, and for each one,
see which integer type is the one you'd like to use. Ideally
unsigned int should be the best choice, since it's *supposed*
to have "the natural size suggested by the architecture of the
execution environment" (C99 6.2.5p5), but requirements for backward
compatibility with 32-bit systems often override this suggestion.
Some supposedly 64-bit systems even have 32-bit longs.
It may be that unsigned long will be the best choice on a wide
variety of systems, or perhaps one of the int*fast_t types defined in
<stdint.h> (for implementations that provide <stdint.h>). Or make it
a build-time configuration option, chosen manually for each target.
You should also profile your code with both 32-bit and 64-bit
integers on each platform. You might be surprised by the results.
I don't have any particular surpise in mind, I'm just saying that
you shouldn't make assumptions.