delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/13/10:02:44

Xref: news2.mv.net comp.os.msdos.djgpp:5942
From: Dominique DOT Pelle AT ingenieurs DOT supelec DOT fr (Dominique PELLE)
Newsgroups: comp.os.msdos.djgpp
Subject: funny exit() bug ? try this...
Date: Sat, 13 Jul 1996 21:14:21 GMT
Organization: Supelec Metz
Lines: 66
Message-ID: <4s83oq$du@prof.ese-metz.fr>
NNTP-Posting-Host: netrider-port1.supelec.fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm using DJGPP for few month now, and I'd like to congratulate 
the GNU and DJGPP team.

I have noticed a strange behaviour when calling exit() in a destructor
for static object. In this case, exit() *DOES NOT* exit :))))) 
I guess this is a bug. If it is not, then can someone explain me.

Here's a simple example, the program does nothing interesting but
shows what might be a bug :

// --- cut here ----------------------------------------------------
// exit() strange behaviour example
#include <assert.h>

class t_foo {
public:
   ~t_foo() { assert(0); }  // always false assertion, calls exit
};

t_foo foo;                  // static allocation

int main() {
   return 0;                // how can I do easier? :)))
}
// --- cut here ----------------------------------------------------

And here is the bug:
C:\gcc -o foo foo.cc -lgpp
C:\foo

Assertion failed at foo.cc line 5: 0
Exiting due to signal SIGABRT
Assertion failed at foo.cc line 5: 0
Exiting due to signal SIGABRT
Assertion failed at foo.cc line 5: 0
Exiting due to signal SIGABRT
Assertion failed at foo.cc line 5: 0
Exiting due to signal SIGABRT
Assertion failed at foo.cc line 5: 0
Exiting due to signal SIGABRT
Assertion failed at foo.cc line 5: 0
....
....
!!!ENDLESS EXIT MESSAGES!!!

Here's some info on my system and DJGPP compiler version:
C:\gcc --version
2.7.2

C:\>go32-v2
go32/v2 version 2.0 built Jan 23 1996 22:03:02
Usage: go32 coff-image [args]
Rename this to go32.exe only if you need a go32 that can run v2
binaries as
 well as v1 binaries (old makefiles).  Put ahead of the old go32 in
your PATH.
DPMI memory available: 8156 Kb
DPMI swap space available: 5296 Kb

--
================================================ \|/ ____ \|/
e-mail --> Dominique DOT Pelle AT ingenieurs DOT supelec DOT fr  @~/ .. \~@
D. PELLE is Copyleft on IRC & Patator on FICS    /_( \__/ )_\
================================================    \__U_/


- Raw text -


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