c++ - Can the exit code of a process overflow for small values? -


i writing testing framework , in main() return number of failed tests. example:

int main() {     int failedtests = runtests();     return failedtests; } 

so can "int" overflow? can %error_level% == 0 when returned different 0? depend on host operating system? usual maximum values? can sure integer < 32768 (2^16 - short) fit?

edit:

i've had problems python sys.exit uses 0-127 range (almost) careful now

it depends upon operating system. on linux, restricted 8 bits, can 0 (for success) or positive integer not greater 255. see _exit(2) & wait(2).

only 2 values standardized (by name): exit_success (usually 0) , exit_failure (often 1). notice standard defines name (and behavior of exit(0);...) not value.

you write number (of failed tests) stdout or file specified thru program argument.

freebsd has defined in sysexits(3) set of exit names , codes, not standardized, e.g. in posix. see posix documentation on exit.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -