Semantics of MODIFY_EXPR with CONSTRUCTOR rhs

Richard Henderson rth@redhat.com
Mon Aug 2 08:51:00 GMT 2004


On Mon, Aug 02, 2004 at 10:15:02AM +0200, Gabriel Dos Reis wrote:
> | >   r = {.x=5, .y=8};
> | >   r = {.x=1, .y=r.x};
...
> My understanding is that it is a behvaiour unspecified by the C99
> standard, 6.7.8 Initialization:
> 
>        [#23] The order in which any side effects  occur  among  the
>        initialization list expressions is unspecified.130)

Irrelevant.  In C99, constructors can happen in only two places:

  (1) The declaration.  In which case we *can't* have assigned
      to the object before, so self-reference can only be erroneous.

  (2) A compound literal.  In which case we explicitly are creating
      a temporary object, which means that the entire rhs *must* be
      constructed first.


r~



More information about the Gcc mailing list