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

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

c# - Avoiding duplicate methods for Task and Task<T> -

javascript - Which segment of a polyline was clicked? -