Exit Codes Windows ((better)) Online

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."

> err 0xC0000005 # for hex 0xc0000005 / decimal -1073741819 STATUS_ACCESS_VIOLATION Check against Win32 error codes: exit codes windows

These are STILL_ACTIVE (thread) and STATUS_PENDING (process). Seeing them from GetExitCodeProcess means you called it before the process actually exited. This is a classic race. If your main() throws an uncaught C++ exception,