Topic: Order of destruction of autos


Author: clamage@taumet.eng.sun.com (Steve Clamage)
Date: 1996/11/05
Raw View
In article 1@mhade.production.compuserve.com, Rick Johnson
<104350.2267@CompuServe.COM> writes:
>Does the standard specify that autos be destroyed in reverse
>order of construction? The ARM describes globals, statics, and
>arrays as working this way, but I can't find a statement on
>autos.

Omitting the mention of auto objects was an oversight in the ARM,
corrected long ago in the draft standard. Auto objects are destroyed
in reverse order of construction.
---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ 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: Rick Johnson <104350.2267@CompuServe.COM>
Date: 1996/11/05
Raw View
Does the standard specify that autos be destroyed in reverse
order of construction? The ARM describes globals, statics, and
arrays as working this way, but I can't find a statement on
autos.

Specifically, I've a class where the constructor does a connect.
Another class does an open. If I code
{
  ConnectClass  Connect_handle();
  OpenClass Open_handle(Connect_handle);
 ...
}

am I guaranteed by the standard that Open_handle will always be
destroyed before Connect_handle when I leave the scope of this
routine.

Thanks.

--




[ 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                             ]