This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Re: Wrong destruction order of static objects in g++
- To: oliva at dcc dot unicamp dot br, rth at cygnus dot com
- Subject: Re: [patch] Re: Wrong destruction order of static objects in g++
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Sun, 7 Jun 1998 13:32:47 -0400 (EDT)
- Cc: Klaus-Georg dot Adams at chemie dot uni-karlsruhe dot de, egcs-bugs at cygnus dot com, egcs-patches at cygnus dot com, jkanze at otelo dot ibmmail dot com
> From: Alexandre Oliva <oliva@dcc.unicamp.br>
>
> Richard Henderson <rth@dot.cygnus.com> writes:
>
> > On Thu, Jun 04, 1998 at 04:25:56PM -0300, Alexandre Oliva wrote:
> >> I don't think so, but it's easy to work around this problem. Here's a
> >> patch that adds this test case.
> > [...]
> >> +int main() {}
>
> > Don't forget to exit(0).
>
> There's no need for that in C++. Falling off main() is equivalent to
> returning zero.
> --
> Alexandre Oliva
Also, doesn't calling exit(0) bypass destructors?
The above code doesn't create any objects, but for the general C++ test
case I think an explicit `return 0' is better than exit(0) (or falling
off main() for that matter.)
--Kaveh
--
Kaveh R. Ghazi Project Manager / Custom Development
ghazi@caip.rutgers.edu Icon CMT Corp.