🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2515

Re: New treatment of 'for (int i ...'

#2515
From: JdeBP
Date: Sat, 11 Nov 1995 06:08
26 lines
1554 bytes
In article <9531318.2076@mulga.cs.mu.OZ.AU> you wrote:
: There is a neat hack which gives you the new behaviour with old compilers:

: 	#ifdef USE_HACK_FOR_NEW_FOR_SCOPE
: 	#define for(x) if (0) ; else for(x)
: 	#endif

: (Did I get that right this time?)

No.  (-:

( Hint : you may want to consult the substitution rules for function-like
  macros again. ) 

I've started to use this macro, and I can report that it has one serious
drawback.  The compiler spits out reams of useless "a constant was used 
as the controlling expression in an if statement" warnings.  (-:

Oh yes ... it also tells me that my macro overrides the keyword "for".

I wish I was allowed to use the compiler that has the facility to
selectively disable warnings ...
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <199511110406.VAA27778@ncar.ucar.EDU>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 11 Nov 95 06:08:05 GMT
Approved: fjh@cs.mu.oz.au
From: JdeBP@jba.co.uk
Message-ID: <199511110406.VAA27778@ncar.ucar.EDU>
X-Original-Date: Sat, 11 Nov 1995 03:06:04 GMT
Subject: Re: New treatment of 'for (int i ...'
Newsgroups: comp.std.c++
Organization: JBA Software Products, Studley, England.
Reply-To: JdeBP%utopium@jba.co.uk
X-Newsreader: TIN [version 1.2 PL2]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMKQ9z+EDnX0m9pzZAQHKTwF+KQerhLZXvdaRj0uXkLFv+hFJZGca7zSQ
 mtoiBEFCoEEJakg8DItlT6CFkNkMgI+o
 =KVu4