Windows - Exit Codes
> net helpmsg 2 The system cannot find the file specified. If the program is well-known (e.g., robocopy , xcopy ), consult its documentation—they reuse Win32 error codes with different meanings.
If your main() throws an uncaught C++ exception, the CRT catches it, calls terminate() , and then ExitProcess(3) . The code 3 means nothing about your logic—it simply signals "CRT abnormal termination." exit codes windows
This overlap is a trap: an exit code of 2 could mean "invalid parameter" (application-defined), or it could mean ERROR_FILE_NOT_FOUND from a failed CreateFile . Without the program's documentation, you cannot disambiguate. Three common scenarios produce exit codes that are technically correct but semantically useless: > net helpmsg 2 The system cannot find the file specified
