Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: error_t proposal Date: Thu, 05 Sep 2019 15:14:20 -0700 Organization: None to speak of Lines: 31 Message-ID: References: <5d03868d-22f7-4c7f-9f9b-1e70d8d8e6f2@googlegroups.com> <5d70c108$0$14374$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="bdc446bce191e4e891bf0ef7ae57c831"; logging-data="32615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5Q9XwUIGY4L76dE3DKpt7" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:EcFKAcFb4tQMsFjaEbMYSfdpdbg= sha1:LCbRPFy7M377nJEmyylYUnH4v6s= Xref: csiph.com comp.lang.c:146048 James Kuyper writes: > On 9/5/19 5:31 PM, Keith Thompson wrote: > ... >> VMS (VAX is the hardware, which can also run Unix) does the same for the >> return status of a program -- which is probably part of the reason we >> have the EXIT_SUCCESS and EXIT_FAILURE macros in . When I >> worked on VMS, I sometimes ran into C programs that used "return 1;" or >> "exit(1);" to indicate failure, but that indicates success on VMS. >> >> (But "return 0;" or "exit(0);" is required to return a successful >> status, even though the OS treats that as a failure code.) > > "If the value of status is zero or EXIT_SUCCESS, an > implementation-defined form of the status _successful termination_ is > returned." (7.20.4.3p5). > I don't believe that a status which the OS treats as a failure code > could qualify as a successful status. On a platform where successful > statuses are indicated by odd values, exit(0) must return an odd status. > > "If the return type of the main function is a type compatible with int, > a return from the initial call to the main function is equivalent to > calling the exit function with the value > returned by the main function as its argument; ..." (5.1.2.2.3p1). > So the same should also be true of "return 0;" from main(). Yes, I didn't mean to imply otherwise. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */