MESSAGE
DATE | 2011-06-11 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] (fwd) Using sizeof in the preprocessor
|
-- forwarded message -- Content-Type: text/plain; charset="ISO-8859-1" From: Johannes Schaub Reply-To: schaub.johannes-at-googlemail.com Date: Sat, 21 May 2011 15:35:53 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Newsgroups: comp.lang.c++ Subject: Using sizeof in the preprocessor Followup-To: comp.lang.c++ MIME-Version: 1.0 Lines: 12 Message-ID: <4dd7bfa5$0$7624$9b4e6d93-at-newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 21 May 2011 15:35:33 CEST NNTP-Posting-Host: 7825a840.newsspool1.arcor-online.net X-Trace: DXC=KhPclBcGnNL78PK[oJ2ng-at-ic==]BZ:afN4Fo<]lROoRA<`=YMgDjhgB-at-FEQ;Q4I-at-5H8nF`Ooo-at-laC<RM4XCEm1:ZIQbMX-Complaints-To: usenet-abuse-at-arcor.de Path: reader1.panix.com!panix!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news.in2p3.fr!in2p3.fr!feed.ac-versailles.fr!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Xref: panix comp.lang.c++:1085095
I have this code in my pet project
#if sizeof -1 > 4 #error "This doesn't work on 64bit" #endif
My friend was telling me that this shouldn't work because "sizeof is not evaluated in the preprocessor". Yet the compiler accepts it and my program works.
Can anybody please explain this? Is it a compiler bug? Thanks to all!
-- end of forwarded message --
|
|