1

I need to decide which exit code to exit() with in different scenarios. I just read

Are there any standard exit status codes in Linux?

but I need to write something that is (sort of) cross-platform Linux+Windows. MS Windows does not seem to have something like /usr/include/sysexits.h; it only has C89's stdlib.h, which provides

#define EXIT_SUCCESS    0
#define EXIT_FAILURE    1

So are these two the only thing that's portable? Or does Windows have some more elaborate platform-standard exit codes?

Note: I don't mean the System Error Codes of course.

Community
  • 1
  • 1
einpoklum
  • 86,754
  • 39
  • 223
  • 453
  • The de-facto standard is to either return 0/1 or to return a system error code (or exception code). But not everybody follows it. – Harry Johnston Jul 21 '15 at 00:24
  • @HarryJohnston: Reference to this being the standard? – einpoklum Jul 21 '15 at 04:08
  • Actually the most common behaviour is probably to just return 0. Most GUI programs assume nobody will be looking at the return code anyway, which I suppose is true most of the time. Personally I prefer to return an error code, or 1 if there is no specific error code applicable. – Harry Johnston Jul 21 '15 at 04:32

1 Answers1

1

Is there a Windows equivalent of standard(ish) UN*X process exit codes?

No, as in practise there are not IXis standard exit codes (besides that 0 indicates success and everything else something else).

alk
  • 66,653
  • 10
  • 83
  • 219