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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -