Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Return codes

  1. #11
    Join Date
    Mar 2003
    Location
    Colorful Colorado
    Posts
    1,096
    I sure don't know of any where non-zero means success. As I mentioned earlier, various values of codes can tell you why something failed: 1: file not found, 2: read only, 3: divide by zero, etc.

    But I've never needed this kind of breakdown after a success ... 1: it worked because the file was found, 2: it worked because the file was read-write, 3: good work you didn't divide by zero So zero is used for success because it is a single value and that is all you need, non-zero is because it is multivalued and is needed.
    Chuck
    Digital Spectra
    (rendering with pixels)

  2. #12
    Join Date
    Sep 2006
    Posts
    57
    Technically, there is a header file that gives EXIT_FAILURE, which depending on the OS changes to indicate failure on the respective platform, and it is "good form" (read: needless formality) to use EXIT_SUCCESS if you use EXIT_FAILURE for consistency's sake. In practice, everything I know uses 1 for failure and 0 for success.

  3. #13
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    877
    Quote Originally Posted by Aholio
    Thanks, it seemed rather silly to me to have to include cstdlib on everything I made, just to have EXIT_SUCCESS. But hey, anything for a good grade, right?
    Hehe, yeah... I don't have too much confident in anything-computer-related-teachers.
    My programming teacher was still using 'void main()' with no return-statement a year ago :]
    And what my HTML-teacher tells us to use are old standards... I think...

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •