home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / c / 13565 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  1.6 KB

  1. Path: sparky!uunet!ogicse!das-news.harvard.edu!spdcc!dirtydog.ima.isc.com!karl
  2. From: karl@ima.isc.com (Karl Heuer)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: main()
  5. Message-ID: <1992Sep11.223347.5184@ima.isc.com>
  6. Date: 11 Sep 92 22:33:47 GMT
  7. Article-I.D.: ima.1992Sep11.223347.5184
  8. References: <1992Sep4.191347.27577@klaava.Helsinki.FI> <1992Sep10.003907.15391@sq.sq.com> <MJN.92Sep10232853@pseudo.uucp>
  9. Sender: usenet@ima.isc.com (news)
  10. Organization: Interactive Systems, Cambridge, MA 02138-5302
  11. Lines: 21
  12.  
  13. In article <MJN.92Sep10232853@pseudo.uucp> mjn@pseudo.uucp (Murray Nesbitt) writes:
  14. >In my opinion, the Standards committee broke exit().  Suppose I am [using
  15. >VMS].  How do I explicitly return the value 0 to VMS from my program?
  16.  
  17. You call sys$exit(0).
  18.  
  19. Suppose I'm using a system on which the native system call takes a string
  20. argument instead of a number.  (A much better model, I think.)  Should I blame
  21. X3J11 for insisting that exit() doesn't accomodate me?
  22.  
  23. >Why is there a reluctance to use [EXIT_SUCCESS and EXIT_FAILURE]?
  24.  
  25. From my own perspective, it's because they aren't expressive enough -- I
  26. like to have Unix programs return 0 for "Yes", 1 for "No", 2 for "Bad args"
  27. (e.g. can't open the file whose name was specified as an argument), 3 for
  28. "Internal error" (including insufficient memory).  For true portability,
  29. I should use different symbolic names for these (and have the non-zero values
  30. all expand to the value of EXIT_FAILURE on sufficiently impoverished systems),
  31. but I haven't gotten around to reorganizing my existing code that way, yet.
  32.  
  33. Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
  34.