This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GCC's statement expression extension


On Jul 29, 2000, Mark Mitchell <mark@codesourcery.com> wrote:

>>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:

Alexandre> Is `return' currently usable within
Alexandre> statement expressions?

> Yes, but that means `return from this function'

Damn!  I was hoping it would be either invalid or not supposed to
work :-(

> So, making `return' in a statement expression mean `exit the statement
> expression' would be the worst kind of change: it would change the
> meaning of valid programs.

Yup.

> I think the only compellilng arguments for keeping statement
> expressions in C++ are:

>   o They appear in headers that we need to compile in C++.
  
>   o Some users may rely on them.

> Those are important arguments, but I don't think there's a compelling
> reason in the language itself.

Yep.

How about, for a start, mandating that the result of a statement
expression be a POD object?  This would get us rid of the problem of
handling destructors and would be codifying existing practice, since,
if my understanding is correct, non-PODs get their destructors run
before the result is made available.  At the very least, we could
issue a warning for this case.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]