delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/25/17:37:02

Sender: nate AT cartsys DOT com
Message-ID: <374B1768.BB1CF208@cartsys.com>
Date: Tue, 25 May 1999 14:34:32 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.5 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: STL
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990525110152 DOT 24405O-100000 AT is>
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019