In an application I maintain, we\'ve encountered a problem with file descriptor limitations affecting the stdlib. This problem only affects the 32-bit version of the standar
You could check a well known type for it's size e.g. sizeof(int*) == 4 for a 32 bit platform.
As sizeof is known at compiletime I believe a
if(sizeof(int*) == 4)
{
...
}
should do the trick
Edit: the comments are right, you need to use a regular if, #if won't work.
If you are using C++ You could create templated code and let the compiler choose the specialization for you based on the sizeof() call. If you build for a 32 bit platform the compiler would only instantiate the code for the 32 bit platform. If you build for a 654 bit platform the compiler would only instantiate the code for the 64 bit platform.