Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » C++

Defect Report: Garbled Description of the "continue" Stateme

 
Jump to:  
 
Greg Herlihy
PostPosted: Tue Aug 26, 2008 3:49 pm    Post subject: Defect Report: Garbled Description of the "continue" Stateme
       
{ Please note that posting a defect report to clc++m does not constitute an
official defect report (as it did with comp.std.c++). -mod }

I noticed that the description of the "continue" statement [§6.6.2]
(both the C++ 2003 Standard and in the N2691 draft) appears to be
garbled - or at least self-contradictory. Specifically, the paragraph
describing "continue" starts with:

"The 'continue' statement shall occur only in an iteration-
statement and..."

So far, so good. The paragraph then concludes:

"a 'continue' not contained in an enclosed iteration statement is
equivalent to goto contin.[sic]"

So, based on this description, can a 'continue' statement appear
outside of an iteration statement or not? Most C++ compilers (and
probably most C++ programmers) would treat a "continue" statement
outside of an iteration loop as an error; but the second part of the
paragraph quoted above, seems to suggest otherwise.

So I think some clarification on the use of the "continue" statement
is needed.

Greg



--
[ See LINK for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 

 
Stefan Ram
PostPosted: Wed Aug 27, 2008 1:46 am    Post subject: Re: Defect Report: Garbled Description of the "continue" Sta
       
Greg Herlihy <greghe@mac.com> writes:
Quote:
So far, so good. The paragraph then concludes:
"a 'continue' not contained in an enclosed iteration statement is
equivalent to goto contin.[sic]"
So, based on this description, can a 'continue' statement appear
outside of an iteration statement or not?

»enclosed« refers to a hypothetical iteration statement that
might be enclosed by the iteration statements of the example
that appears ini ISO/IEC 14882:2003(E), 6.6.2p1 directly in
front of the above quote.


--
[ See LINK for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 

 
Pete Becker
PostPosted: Wed Aug 27, 2008 1:47 am    Post subject: Re: Defect Report: Garbled Description of the "continue" Sta
       
On 2008-08-26 05:49:39 -0400, Greg Herlihy <greghe@mac.com> said:

Quote:
{ Please note that posting a defect report to clc++m does not constitute an
official defect report (as it did with comp.std.c++). -mod }

I noticed that the description of the "continue" statement [§6.6.2]
(both the C++ 2003 Standard and in the N2691 draft) appears to be
garbled - or at least self-contradictory. Specifically, the paragraph
describing "continue" starts with:

"The 'continue' statement shall occur only in an iteration-
statement and..."

So far, so good. The paragraph then concludes:

"a 'continue' not contained in an enclosed iteration statement is
equivalent to goto contin.[sic]"

So, based on this description, can a 'continue' statement appear
outside of an iteration statement or not? Most C++ compilers (and
probably most C++ programmers) would treat a "continue" statement
outside of an iteration loop as an error; but the second part of the
paragraph quoted above, seems to suggest otherwise.

So I think some clarification on the use of the "continue" statement
is needed.


That concluding sentence refers to the three loop statements above it,
and the mention of "in an enclosed iteration statement" refers to an
additional iteration statement inside the loop body. For example, the
first loop statement is:

while (foo) {
{
// ...
}
contin: ;
}

If the comment inside the innermost braces is replaced with an
iteration statement, a continue inside that iteration statement is not
a "goto contin", i.e. it doesn't jump outside its containing iteration
statement:

while (foo) {
{
for (;Wink {
continue; // NOT a goto contin
}
continue; // goto contin
}
contin: ;
}

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)



[ See LINK for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 

 
Alberto Ganesh Barbati
PostPosted: Wed Aug 27, 2008 6:05 am    Post subject: Re: Defect Report: Garbled Description of the "continue" Sta
       
Greg Herlihy ha scritto:
Quote:
{ Please note that posting a defect report to clc++m does not constitute an
official defect report (as it did with comp.std.c++). -mod }

I noticed that the description of the "continue" statement [§6.6.2]
(both the C++ 2003 Standard and in the N2691 draft) appears to be
garbled - or at least self-contradictory. Specifically, the paragraph
describing "continue" starts with:

"The 'continue' statement shall occur only in an iteration-
statement and..."

So far, so good. The paragraph then concludes:

"a 'continue' not contained in an enclosed iteration statement is
equivalent to goto contin.[sic]"

So, based on this description, can a 'continue' statement appear
outside of an iteration statement or not? Most C++ compilers (and
probably most C++ programmers) would treat a "continue" statement
outside of an iteration loop as an error; but the second part of the
paragraph quoted above, seems to suggest otherwise.

So I think some clarification on the use of the "continue" statement
is needed.


I think the wording is clear and certainly not defective. In the second
sentence "a 'continue' not contained in an enclosed iteration statement
is equivalent to goto contin" the key word is *enclosed*. Such statement
therefore refers only to the case where the continue statement occurs in
an iteration statement *enclosed* in another iteration statement.

Ganesh


--
[ See LINK for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 

 
Greg Herlihy
PostPosted: Thu Aug 28, 2008 8:51 pm    Post subject: Re: Defect Report: Garbled Description of the "continue" Sta
       
On Aug 26, 11:05 pm, Alberto Ganesh Barbati <AlbertoBarb...@libero.it>
wrote:
Quote:
Greg Herlihy ha scritto:

"a 'continue' not contained in an enclosed iteration statement is
equivalent to goto contin.[sic]"

So, based on this description, can a 'continue' statement appear
outside of an iteration statement or not? Most C++ compilers (and
probably most C++ programmers) would treat a "continue" statement
outside of an iteration loop as an error; but the second part of the
paragraph quoted above, seems to suggest otherwise.

So I think some clarification on the use of the "continue" statement
is needed.

I think the wording is clear and certainly not defective. In the second
sentence "a 'continue' not contained in an enclosed iteration statement
is equivalent to goto contin" the key word is *enclosed*. Such statement
therefore refers only to the case where the continue statement occurs in
an iteration statement *enclosed* in another iteration statement.

The problem with the paragraph quoted is that the meaning of the term
"iteration statement" shifts from its first appearance to its second.
The first "iteration statement" refers to any iteration statement in C+
+, whereas the second refers only to the particular iteration
statements inside a specific example.

The C++ Standard usually distinguishes normative text from example
descriptions by bracketing the latter with "[Example:" and "--end
example]". Because - unless the example description is set apart from
the normative text (as it is with, say, the "for" or "while" statement
descriptions), it becomes all too easy to misread the description of a
single example - as a requirement that applies to all C++
implementations.

Greg



--
[ See LINK for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 

 
Alberto Ganesh Barbati
PostPosted: Fri Aug 29, 2008 4:37 am    Post subject: Re: Defect Report: Garbled Description of the "continue" Sta
       
Greg Herlihy ha scritto:
Quote:

The C++ Standard usually distinguishes normative text from example
descriptions by bracketing the latter with "[Example:" and "--end
example]". Because - unless the example description is set apart from
the normative text (as it is with, say, the "for" or "while" statement
descriptions), it becomes all too easy to misread the description of a
single example - as a requirement that applies to all C++
implementations.


I don't get your point. There is no example in 6.6.2. The three code
snippets are deliberately in normative text because they are needed to
(normatively) describe the behaviour of continue in terms of goto.

Ganesh

--
[ See LINK for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 

 
Pete Becker
PostPosted: Fri Aug 29, 2008 4:58 am    Post subject: Re: Defect Report: Garbled Description of the "continue" Sta
       
On 2008-08-28 10:51:50 -0400, Greg Herlihy <greghe@mac.com> said:

Quote:

The problem with the paragraph quoted is that the meaning of the term
"iteration statement" shifts from its first appearance to its second.
The first "iteration statement" refers to any iteration statement in C+
+, whereas the second refers only to the particular iteration
statements inside a specific example.

Those are not examples. They are the three forms of iteration
statement, and that paragraph, with the three code blocks it includes,
defines the behavior of the continue statement for iteration statements.

Quote:

The C++ Standard usually distinguishes normative text from example
descriptions by bracketing the latter with "[Example:" and "--end
example]". Because - unless the example description is set apart from
the normative text (as it is with, say, the "for" or "while" statement
descriptions), it becomes all too easy to misread the description of a
single example - as a requirement that applies to all C++
implementations.

Right. Those three code blocks are not examples, which is why they are
not marked as examples.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)



[ See LINK for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

9fashion Teledyski Download Ściąganie należności komody Diety