Topic: temporaries


Author: stephen.clamage_nospam@eng.sun.com (Steve Clamage)
Date: 1997/10/01
Raw View
On 01 Oct 97 14:32:42 GMT, inpact3 <inpact3@clr34el.der.edf.fr> wrote:

>I am a bit disoriented by the wording used in CD2 [class.temporary]
>paragraph 4. In this paragraph, we can read :
>
>  [...] In that context, the temporary that hold the result of the
>  expression shall persist until the object's initialization is
>  complete.
>
>and, two lines latter :
>
>  [...] the temporary is destroyed after it has been copied,
>  before or when the initialization is complete.
>
>Seems like the two sentences have opposed meaning !!!

They refer to different cases. Here is the complete paragraph:

"There are two contexts in which temporaries are destroyed at a
different point than the end of the full-expression. The first context
is when an expression appears as an initializer for a declarator
defining an object. In that context, the temporary that holds the
result of the expression shall persist until the object's
initialization is complete. The object is initialized from a copy of
the temporary; during this copying, an implementation can call the
copy constructor many times; the temporary is destroyed after it has
been copied, before or when the initialization completes. If many
temporaries are created by the evaluation of the initializer, the
temporaries are destroyed in reverse order of the completion of their
construction."

First context: The temp that holds the result of the initializing
expression. That temp persists until initialization is complete.

Second context: Additional copies (which are also temps) created
during evaluation of the initializing expression These extra copies
need not persist until initialization is complete.

---
Steve Clamage, stephen.clamage_nospam@eng.sun.com
( Note: remove "_nospam" when replying )
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: inpact3 <inpact3@clr34el.der.edf.fr>
Date: 1997/10/01
Raw View
Hi C++ gurus !

I am a bit disoriented by the wording used in CD2 [class.temporary]
paragraph 4. In this paragraph, we can read :

  [...] In that context, the temporary that hold the result of the
  expression shall persist until the object's initialization is
  complete.

and, two lines latter :

  [...] the temporary is destroyed after it has been copied,
  before or when the initialization is complete.

Seems like the two sentences have opposed meaning !!!

Did I miss something ?
Jerome CHAROUSSET

PS: I wonder why there is no example in this paragraph (as in
paragraph 5 for instance); it would definitely add some clarity...
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]