c++ - Return codes for int main - is there a cap? -
this question has answer here:
i have been playing around return codes today created loop in bash test out:
for rc in {1..300} echo "int main(void) { return $rc; }" > test.cpp g++ test.cpp -o test ./test echo $? done
however after reaching 255 seems begin 0 again. why that?
eg:
252 253 254 255 0 1
because return codes in posix-compliant systems limited range [0-255].
with regard bash, here handy reference on exit statuses.
Comments
Post a Comment