Mail Archives: djgpp/1999/05/25/17:37:02
Eli Zaretskii wrote:
>
> On Mon, 24 May 1999, Guillermo Rodriguez Garcia wrote:
>
> > "A return statement in main has the effect of leaving the main
> > function (destroying any objects with automatic storage duration) and
> > calling exit with the return value as the argument. If control reaches
> > the end of main without encountering a return statement, the effect is
> > that of executing:
> >
> > return 0;"
> >
> > I suggest to correct this for the next version of DJGPP.
>
> This is not a DJGPP matter, it is a C++ library matter. DJGPP only
> supplies a C library, and for that the rules of C89 or C9x are the
> defining standards. If C++ requires a different handling of the exit
> status, the necessary code should already be in the C++ library
> shut-down procedure. Otherwise the C++ library violates the C++
> standard, and you should report that as a bug to the GNU C++ library
> maintainer(s).
>
> The C++ library supplied with DJGPP is simply a port of the GNU C++
> library, like other ports in v2gnu directory. It is not developed
> as part of DJGPP, and therefore any genuine bugs should be reported
> elsewhere.
Before the discussion here gets too out of hand: IT ALREADY WORKS. The
compiler handles it. Compile as C++ the minimal program:
int main(void) { }
and look at the assembly. "xorl %eax, %eax". `main' does in fact
return 0 in the absence of other returns.
C, of course, does not do this.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -