MESSAGE
DATE | 2011-06-11 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] (fwd) Re: Using sizeof in the preprocessor
|
From owner-hangout-outgoing-at-mrbrklyn.com Sat Jun 11 01:04:50 2011 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: by www2.mrbrklyn.com (Postfix) id E4C9C100B7F; Sat, 11 Jun 2011 01:04:49 -0400 (EDT) Delivered-To: hangout-outgoing-at-www2.mrbrklyn.com Received: by www2.mrbrklyn.com (Postfix, from userid 28) id 02211100B0B; Sat, 11 Jun 2011 01:04:48 -0400 (EDT) Delivered-To: hangout-at-nylxs.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by www2.mrbrklyn.com (Postfix) with ESMTP id F2CC4100B3E for ; Sat, 11 Jun 2011 01:04:44 -0400 (EDT) Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 4B6DF320E3 for ; Sat, 11 Jun 2011 01:04:43 -0400 (EDT) Received: by panix2.panix.com (Postfix, from userid 20529) id 39B9633C5F; Sat, 11 Jun 2011 01:04:43 -0400 (EDT) From: Ruben Safir To: hangout-at-nylxs.com Subject: [NYLXS - HANGOUT] (fwd) Re: Using sizeof in the preprocessor User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (NetBSD/5.1 (i386)) Message-Id: <20110611050443.39B9633C5F-at-panix2.panix.com> Date: Sat, 11 Jun 2011 01:04:43 -0400 (EDT) Sender: owner-hangout-at-mrbrklyn.com Precedence: bulk Reply-To: hangout-at-mrbrklyn.com
-- forwarded message -- Path: reader1.panix.com!panix!news.linkpendium.com!news.linkpendium.com!feeder.erje.net!news2.arglkargh.de!noris.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" From: Johannes Schaub Reply-To: schaub.johannes-at-googlemail.com Date: Sat, 21 May 2011 22:19:41 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: Using sizeof in the preprocessor Newsgroups: comp.lang.c++ References: <4dd7bfa5$0$7624$9b4e6d93-at-newsspool1.arcor-online.net> Followup-To: comp.lang.c++ MIME-Version: 1.0 Lines: 22 Message-ID: <4dd81e48$0$6557$9b4e6d93-at-newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 21 May 2011 22:19:21 CEST NNTP-Posting-Host: 070ace45.newsspool4.arcor-online.net X-Trace: DXC=LaG_-at-aL\=mM74okIm;?DS-at-4IUKRM4XCEm1:ZIQbMX-Complaints-To: usenet-abuse-at-arcor.de Xref: panix comp.lang.c++:1085131
Johannes Schaub wrote:
> 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!
I want to emphasize that I do *not* intent to troll. I wanted to raise a common issue and put people in alert mode when they see such code and don't get a compiler error.
See http://chat.stackoverflow.com/transcript/message/752965#752965 and the following rage of "FredNurk" for the discussion and why I need to defend this question like that.
-- end of forwarded message --
|
|