delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/24/08:11:24

From: Weiqi Gao <weiqigao AT a DOT crl DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Exit codes?
Date: Wed, 23 Jun 1999 21:33:44 -0500
Organization: CRL Network Services
Lines: 41
Message-ID: <37719908.3CACA25C@a.crl.com>
References: <7ks25v$o7s$1 AT nnrp1 DOT deja DOT com>
NNTP-Posting-Host: a116025.stl1.as.crl.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i586)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I1269U wrote:
> 
> You know how djgpp displays the exit code upon program termination
> (when running it from within DJGPP that is)?

I take it that you meant to say "from within RHIDE", the Borlandish IDE
usually associated with DJGPP.

> Well, no other compiler that I've used has done that, and I often
> see exit codes other than 0 pop up.

The Microsoft compiler tells you the exit code too, if you run it inside
their IDE.

> [...] When I'd run it, it would go through without
> any kind of visible problem, but it was saying the exit code was 10
> (0x000a).

That's the return value of your main() function.  You probably didn't
have a return statement in your main() function, and an arbitrary value
was supplied for you by the compiler.  If you put a "return 0;" right
before your main() terminates, you would see a 0 as the exit code.

> Of course, the other compilers I've used didn't display the
> exit code, so I don't know if this is normal or not.

That's normal.

> It's been my
> experience, though, that the exit code is usually 0, or 1 (when I exit
> on purpose). Is this a normal exit code? And if not (or even if so),
> where can I get a listing of exactly what the exit codes are and what
> they mean? Thanks in advance.

There's no meaning to the system supplied return value to main().  It's
just a number.  If anything, it reminds you to put a return statement
when you a done in main().

-- 
Weiqi Gao
weiqigao AT a DOT crl DOT com

- Raw text -


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