bad evaluation of main() return of -1 by OS

I'm learning C++ through self-study of the 2012 edition of C++ Primer and the first exercise was to write and compile an application in which the only thing that happens is that main() returns -1. The book said I should get an error message when that happens but instead echo $? yielded a value of 255. When main() returns 0 then echo $? yields 0. I run Debian 7.7 and used the command line version of g++ 4.72 to compile the source. Does anyone know why I didn't get a system error?

1
2
int main ()    {
    return -1;    }
System does not have to generate an error when program is unsuccesfull. Generally programs run from console does not raise any reaction from system, as it is assumed that user/script/whatever should handle result of execution itself.
Thanks for the prompt response! I guess that teaches me to learn Python before trying to learn C++ :D
> The book said I should get an error message when that happens
> but instead echo $? yielded a value of 255.
if it wasn't 0, then it terminated with error ¿what's your complain?
Topic archived. No new replies allowed.