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 14:43:39 -0700 Organization: None to speak of Lines: 41 Message-ID: References: <5d03868d-22f7-4c7f-9f9b-1e70d8d8e6f2@googlegroups.com> <270b0679-c176-4e05-9d18-6dc6dcbdb75a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="808e9da1912e399f965b4512b95a962e"; logging-data="32615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199NIegbN1iDjUTjMoPTopQ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:lSeKc+Stx5QoKQkCHGjel/apxBI= sha1:4xOtY0Dpb5S+lV6TCk+N9m10B+8= Xref: csiph.com comp.lang.c:146045 Thiago Adams writes: > On Thursday, September 5, 2019 at 7:01:56 AM UTC-3, Jorgen Grahn wrote: >> On Wed, 2019-09-04, Thiago Adams wrote: >> > >> ... >> > But I think it should be more universal and library implementers >> > could use the same typedef. >> ... >> > What do you think? >> >> https://xkcd.com/927/ >> >> It's too late to change APIs which have existed for 20--40 years. >> > > I don't think this is the case. > Remember, before C99 each programmer was using its own definition > for bool. > > Today, each programmer is using its own definition for what > is error. Before C99, most C programs didn't bother defining a Boolean type. They typically used int, with 0 for false and 1 for true. (A lot of C code still does that.) The definition of what is an error is generally imposed by the OS (POSIX, Windows, etc.). Given that most POSIX functions return 0 on success, and apparently many Windows functions return true (1) on success, I don't think it's feasible to define a consistent std_success constant. A single program could use functions from different libraries with inconsistent error reporting schemes. [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */