Mail Archives: djgpp/1998/01/02/06:00:01
At 22:22 21.12.97 +0100, you wrote:
>Ryan McGee schrieb:
>>
>> Does anyone know where I can find the exit code for RHIDE. Like when it
>> says "EXIT CODE 255" What does that mean? Thanks
>
>The value reported as exit code, is the value which your main function
>returns. If you would have for instance
>
>int main()
>{
> return 3;
>}
>
>RHIDE would report you an exit code of 3.
>
>Robert
1) Exit codes are also generated by the exit() function.
2) As main() is of type int and exit() takes an int parameter
the exit codes are obviously (signed) integer numbers.
But...
All the OS I know of have only unsigned char as exit codes.
The mapping of signed int to unsigned char exit codes
is "implementation-defined" as they call it in ANSI C standard.
Usually exit codes are casted to the OS format WITHOUT WARNING.
Exit Code 255 is therefore most likely caused by
exit(-1)
which is common usage (not standard!) for nonsuccessful
termination. If you like to keep to ANSI C standard
use the macros EXIT_SUCCESS and EXIT_FAILURE as exit codes.
(see stdlib.h for numerical values).
ref: ISO/IEC 9899:1990 p.156, 7.10.4.3 The exit function
Tony
**************************************************************
Dipl.-Ing. Anton HELM *T* mailto:tony AT nt DOT tuwien DOT ac DOT at
Institut fuer *U* http://www.nt.tuwien.ac.at/~tony/
Nachrichtentechnik und *W* http://www.nt.tuwien.ac.at/
Hochfrequenztechnik *I* talkto:tony AT eagle DOT nt DOT tuwien DOT ac DOT at
Guszhausstr. 25/389 *E* phoneto:+43-1-58801-3520
A-1040 Wien, AUSTRIA *N* faxto:+43-1-5870583
**************************************************************
- Raw text -