Allowed or not?

K

Kleuske

Hi,

I have the following code, which works fine under Borland C++ and is refused
by GCC and a subsequent debate on whether or not it's OK. My vote is it's
*not*, since 'sizeof' is not known in the preprocessor.

<code>
#include <stdio.h>

/* checking the sie of a defined type */
#if (sizeof(unsigned long) != 4)
#error Nononononono...
#endif

int main(int argc, char* argv[])
{
printf("*** Yes\n");
return 0;
}
</code>

Question: Is this OK? Compiler dependent? Dead wrong?

Thanks in advance for your comments...

Regards,

Kleuske.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top