As an assignment in school, we have to write a C++ program and returns different error codes in the main
.
The problem is that we have to return -2
From C++11 standard 18.5/8:
If status is zero or EXIT_SUCCESS, an implementation-defined form of the status successful termination is returned. If status is EXIT_FAILURE, an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined.
Thus is it completely compliant that you get different results for different platforms, and/or compilers.