|
Re: Order of Object destruction: msg#00221gcc.help
Eljay Love-Jensen <eljay@xxxxxxxxx> writes: > Hi Neophytos, > > >When the call foo(a) is made the copy constructor is called and > makes a new object "z". This object "z" is supposed to be desposed > off when it goes out of scope. > > Correct. And it does. Temporary object "z" goes out of scope at the > caller's semi-colon. > > Returned object "b" also goes out of scope at the caller's semi-colon. > > >I was asking which was supposed to be desposed of first "z" or "b"? > > I think it is up to the discretion of the compiler's vendor whether > it's a LIFO object destruction at the semi-colon, or FIFO object > destruction. I can't find anything in the standard which requires either of these. Until someone does, you should probably assume any order is possible. (though C++ doesn't allow interleaving of distinct functions, so that isn't possible.) |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Optimization Safety: 00221, LLeweLLyn Reese |
|---|---|
| Next by Date: | -march: 00221, John Anthony Kazos Jr. |
| Previous by Thread: | Re: Order of Object destructioni: 00221, Eljay Love-Jensen |
| Next by Thread: | Converting from gcc-2.96 to gcc-3.2.2: 00221, John McClurkin - LMO |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |