🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

for(a;b;c;d)?

#2198
From: Dr. Richard Botting
Date: Sun, 15 Oct 1995 16:07
45 lines
2325 bytes
I was sketching an example for class and wrote
	for( Digit* p=d, *q=d+1
and suddenly didn't know if this declared 'q' or not.  I was used to
	for( i=0, j=0, k=N;....
and like the new improved
	for( int i=0, j=0, k=N; ...
form.  But started to worry about ambiguities.

This lead me into my 1990 ARM and pages 88,89,397,393,and 410.  And from
there to a fast scan of the comp.lan.c++ FAQ.

If I read it right then the following are all valid:
Form	Syntax				My Reaction
(A):	for(e; e; e)S			//No problem
(B):	for(d; e; e)S			//Neat idea
(C):	for(d; e; e; e)S		//Personal parse error, but neat if OK
(D):	for(e; e; e; e)S		//Personal parse error, and why?
where
	e is an expression,
and	S is any statement,
and	d is any declaration with its semicolon removed.

I was wondering whether the standard will be permitting all the above
and also what kind of discussions and examples might be
on record.

By the way, I tried
  for(int i=1; i++; 0; i++)
        ;
on our local (older rs6000-ibm-aix32/2.4.5 ) Gnu CC and it was 
rejected(parse error before `;').  But compilation does not a standard make.

Also, by the way, I don't mind whether for(;;;) is standard or not, as long
as I know one way or the other.

--
	dick@csci.csusb.edu=rbotting@wiley.csusb.edu.
Find out what's new at http://www.csci.csusb.edu/doc/www.sites.html
Disclaimer:`CSUSB may or may not agree with this message`.
Copyright(1995):Copy this freely but include the following link to the
<a href="http://www.csci.csusb.edu/dick/signature.html">author's signature</a>
---
[ 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: <45r8c1$f2m@news.csus.edu>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 15 Oct 95 16:07:15 GMT
Approved: fjh@cs.mu.oz.au
From: dick@silicon.csci.csusb.edu (Dr. Richard Botting)
Newsgroups: comp.std.c++
Subject: for(a;b;c;d)?
X-Original-Date: 15 Oct 1995 15:12:01 GMT
Organization: CS Dept., Calif. State Univ., San Bernardino
Message-ID: <45r8c1$f2m@news.csus.edu>
X-Newsreader: TIN [version 1.2 PL2]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMIExzeEDnX0m9pzZAQHSTwF/S7U3Vf6e0OPcsnp2FpKpWuH5wEiIXfK3
 rSeqEsUaSYI/UkIxsw9dofpnncsyUqSR
 =yNJP