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


Mark Mitchell wrote:
> Why not?

>   # define __tobody(c, f, a) 
>     (__extension__							      
>      ({ int __res;							      
> 	...						      
> 	__res = a[(int) (c)];						      
> 	__res; }))
> 

> If `c' is `(a + b).c_str()[0]' then a temporary will be created for `a
> + b' when `c' is used as an array index.  That temporary will be
> destroyed [...] inside the statement expression, which is earlier than
> the end of the enclosing full expression.

In this case, the observed behaviour is the same though isn't it?

If the string's destructor changes the current locale it might be
observable (I'm not sure if locales affect toupper), but if you put
that in the documentation it's going to look obscure.

-- Jamie

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