0

Possible Duplicate:
What should main() return in C/C++?

In C++, return 0 tells that the program has ended successfuly.

What about return -1? Does it break (halt) the program?

Community
  • 1
  • 1
Simplicity
  • 47,404
  • 98
  • 256
  • 385

3 Answers3

3

Short answer: no. Returning anything except 0 just means that there was an error.

Gemini14
  • 6,246
  • 4
  • 28
  • 32
  • Nitpicking: eturning `EXIT_SUCCESS` also signifies success, and `EXIT_SUCCESS` can be different from 0. – Philipp Jan 20 '11 at 19:33
1

No, it just sets the return_code environment variable in the shell, with which you can determine whether the program returned fine or with error when you use batch processing.

Windows:

echo %errorlevel%

POSIX:

echo $?

BTW, use EXIT_SUCCESS and EXIT_FAILURE defined in cstdlib

Stefan Steiger
  • 78,642
  • 66
  • 377
  • 442
0

http://www.boost.org/doc/libs/1_45_0/libs/system/doc/index.html#Acknowledgements

Here you can find nice library for system error types.

UmmaGumma
  • 5,633
  • 1
  • 31
  • 45