On Fri, Mar 05, 2010 at 12:06:01PM -0800, Joe Buck wrote:
> On Fri, Mar 05, 2010 at 11:38:23AM -0800, Magnus Fromreide wrote:
> > Hello.
> > 
> > I tried to do
> > 
> > for (;; ({ break; }))
> >     printf("Hello\n");
> > 
> > and got an error message:
> > 
> > error: break statement not within loop or switch
> 
> But it only got through the parser, so that this error message
> could be generated, because you're using a GNU extension: statements
> and declarations in expressions.  That is, ({ break;}) is a GNU
> extension.

I am aware of that.

> > when compiling it as C. Given that 9899:1999 ยง6.8.6.3 says that a break
> > ...
> > importance here.
> 
> But in standard ISO C++, ({ break;}) is not a valid expression.

Agreed.

> Ideally a GNU extension should be specified as well as the rest of the
> standard is specified, but I'm not surprised that this doesn't work.

So you would say this points to a buglet in the specification of statement
expressions?

Or is it a bug in the C++ implementation, but one that is unimportant as it
is impossible to detect using standard C++?

/MF

Reply via email to