|
Re: Order of Object destruction: msg#00206gcc.help
Hi Neophytos, Yes, the order of destruction is specified, due in no small part to the lifespan of a temporary being well-defined. Effectively, the temporary object lives until the end-of-statement semicolon. As I understand it (I've never needed to tried this), if there were an alias to it, it would live until the end of the extant of alias. For example: A a; A& b = foo(a); // a and b are live. cout << a.y << endl; cout << b.y << endl; // Okay. Before the standard's committee nailed the issue, compiler vendors were inconsistent when the temporary object was destructed. Which lead to all sorts of non-portable code and frustrated programmers. --Eljay |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Order of Object destruction: 00206, Neophytos Michael |
|---|---|
| Next by Date: | Re: Order of Object destruction: 00206, Neophytos Michael |
| Previous by Thread: | Order of Object destructioni: 00206, Neophytos Michael |
| Next by Thread: | Re: Order of Object destruction: 00206, Neophytos Michael |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |