By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

Allowed or not?

P: n/a
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.
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Kleuske" <t-******@achter.de.del> schreef in bericht
news:3f***********************@news.xs4all.nl...
<snip>
Question: Is this OK? Compiler dependent? Dead wrong?


Ok I was right. It's *not* OK.

See

http://www.lns.cornell.edu/public/CO...p_1.html#SEC32

http://www.eskimo.com/~scs/C-faq/q10.13.html

Bye...
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.