Topic: Missing ";" in the for statement Grammar
Author: dhb2000@gmail.com (Barry)
Date: Mon, 31 Dec 2007 07:24:45 GMT Raw View
In ISO/IEC 14882:2003,
6.5/1
iteration-statement:
while ( condition ) statement
do statement while ( expression ) ;
for ( for-init-statement _;_ conditionopt ; expressionopt ) statement
^^^
I found out it remained repaired in N2369.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: bitti@cs.tut.fi (Matti Rintala)
Date: Mon, 31 Dec 2007 09:54:51 GMT Raw View
Barry wrote:
> In ISO/IEC 14882:2003,
> 6.5/1
>
> iteration-statement:
> while ( condition ) statement
> do statement while ( expression ) ;
> for ( for-init-statement _;_ conditionopt ; expressionopt ) statement
The semicolon is not missing, it is automatically included in the
for-init-statement (either an expression-statement or a simple-declaration,
both of which end in a semicolon). There is even a note explaining this in
6.5/1, both in 1998 and 2003 versions.
--
------------- Matti Rintala ------------ matti.rintala@tut.fi ------------
Painting is the art of inclusion. Photography is an art of exclusion.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: jdennett@acm.org (James Dennett)
Date: Mon, 31 Dec 2007 15:33:53 GMT Raw View
Barry wrote:
> In ISO/IEC 14882:2003,
> 6.5/1
>
> iteration-statement:
> while ( condition ) statement
> do statement while ( expression ) ;
> for ( for-init-statement _;_ conditionopt ; expressionopt ) statement
> ^^^
>
> I found out it remained repaired in N2369.
>From memory, I believe that a for-init-statement always ends in a
semicolon and this "omission" is therefore deliberate.
-- James
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]