Cap main exit code to 255 (#797)

Changed default main to clamp exit code to 8 bits because of POSIX limitations.

Updated documentation about declaring non-default main.
This commit is contained in:
Jan Včelák 2017-01-31 20:48:14 +01:00 committed by Martin Hořeňovský
parent 7dd4f2977a
commit 1e5176bd69
2 changed files with 9 additions and 4 deletions

View file

@ -12,7 +12,8 @@
// Standard C/C++ main entry point
int main (int argc, char * argv[]) {
return Catch::Session().run( argc, argv );
int result = Catch::Session().run( argc, argv );
return ( result < 0xff ? result : 0xff );
}
#else // __OBJC__
@ -30,7 +31,7 @@ int main (int argc, char * const argv[]) {
[pool drain];
#endif
return result;
return ( result < 0xff ? result : 0xff );
}
#endif // __OBJC__