Thread View: comp.std.c++
1 messages
1 total messages
Started by Dr. Richard Botting
Sun, 15 Oct 1995 16:07
for(a;b;c;d)?
Author: Dr. Richard Botting
Date: Sun, 15 Oct 1995 16:07
Date: Sun, 15 Oct 1995 16:07
45 lines
2325 bytes
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. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads