Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Allowed or not?

Reply
Thread Tools

Allowed or not?

 
 
Kleuske
Guest
Posts: n/a
 
      11-11-2003
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.


 
Reply With Quote
 
 
 
 
Kleuske
Guest
Posts: n/a
 
      11-11-2003

"Kleuske" <t-> schreef in bericht
news:3fb10a8a$0$58713$...
<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...


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why defining a constant in a method is not allowed but usingself.class.const_set is allowed? IƱaki Baz Castillo Ruby 13 05-01-2011 06:09 PM
Allowed Site Blocked after 20 popups?? joe Firefox 1 06-01-2005 11:32 PM
90 day eval software-how many installs allowed? (for learning) XP =?Utf-8?B?TWFyaWU=?= Microsoft Certification 4 08-24-2004 09:57 PM
cisco caller allowed call time Ivana Cisco 1 03-02-2004 02:35 PM
The proper size of ping packet (is fragmentation allowed) Yang Jun Cisco 6 12-20-2003 01:42 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57