Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #146070
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: error_t proposal |
| Date | Fri, 06 Sep 2019 11:18:34 -0700 |
| Organization | None to speak of |
| Lines | 34 |
| Message-ID | <lnblvxthj9.fsf@kst-u.example.com> (permalink) |
| References | <5d03868d-22f7-4c7f-9f9b-1e70d8d8e6f2@googlegroups.com> <slrnqn1n88.cdo.grahn+nntp@frailea.sa.invalid> <270b0679-c176-4e05-9d18-6dc6dcbdb75a@googlegroups.com> <lna7biv2pg.fsf@kst-u.example.com> <0a0905d7-2c2d-45c0-b028-9de1f98fc9e0@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | reader02.eternal-september.org; posting-host="bdc446bce191e4e891bf0ef7ae57c831"; logging-data="1289"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MiQroBJOUX1YpZ9nKtCrp" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:E+YC8O9Ir0YcxWxLlyNAuq0laO8= sha1:nDEjexCOvqh+9NtsyP2yx5KNheY= |
| Xref | csiph.com comp.lang.c:146070 |
Show key headers only | View raw
Thiago Adams <thiago.adams@gmail.com> writes:
[...]
> I am happy to have found errno_t in the C11 standard.
> I will not change bool for errno_t in my current programs (because
> this creates a inverse logic) but I intend to use errno_t in new
> programs.
Then your new programs won't compile with implementations that don't
support the optional Annex K (unless you define errno_t yourself).
> I am starting to think that is not so bad not having a constant
> for success.(that is zero by definition of errno_t)
> POSIX also don't have a 'no error' constant. Maybe if it had
> probably this would be the success constant for errno_t .
>
> Having the type errno_t automatically shows the function contract.
I'll note that the intended use of errno_t is for the value of errno.
Most conventions don't have functions returning error codes. Many POSIX
functions for example, return 0 for success and 1 for failure, with
errno set to indicate which error occurred. (Linux kernel functions
that implement system calls typically return a non-negative value for
success or a negated E* value for failure, but that's mapped to setting
errno when a user-space program calls them.)
I agree it would be nice to have a convention that's (a) more consistent
and (b) returns both the result and the status from the function rather
than using the ugly errno mechanism. But there's only so much you can
do given the existing standards and libraries.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-04 14:14 -0700
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-04 15:20 -0700
Re: error_t proposal Mateusz Viste <mateusz@wont.tell> - 2019-09-05 08:02 +0000
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 04:04 -0700
Re: error_t proposal Bruce S <bruces42@hotmail.com> - 2019-09-05 08:18 -0600
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-05 14:31 -0700
Re: error_t proposal James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-09-05 17:49 -0400
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-05 15:14 -0700
Re: error_t proposal Bruce S <bruces42@hotmail.com> - 2019-09-06 14:03 -0600
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-05 09:30 +1000
Re: error_t proposal Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-09-05 02:38 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 04:57 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 05:16 -0700
Re: error_t proposal Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-09-05 05:35 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 06:08 -0700
Re: error_t proposal Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-09-05 06:16 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 06:37 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 07:04 -0700
Re: error_t proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-09-05 20:51 +0100
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 13:52 -0700
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-05 14:56 -0700
Re: error_t proposal William Ahern <william@25thandClement.com> - 2019-09-05 13:18 -0700
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-06 07:25 +1000
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-06 07:35 +1000
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-06 04:22 -0700
Re: error_t proposal scott@slp53.sl.home (Scott Lurndal) - 2019-09-05 13:59 +0000
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-06 07:10 +1000
Re: error_t proposal Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-09-05 10:01 +0000
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 04:36 -0700
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-05 14:43 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-06 05:01 -0700
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-06 11:18 -0700
Re: error_t proposal scott@slp53.sl.home (Scott Lurndal) - 2019-09-06 19:34 +0000
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-06 12:37 -0700
Re: error_t proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-09-06 20:54 +0100
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-06 13:20 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-06 13:43 -0700
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-06 14:25 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-06 15:14 -0700
Re: error_t proposal Keith Thompson <kst-u@mib.org> - 2019-09-06 15:49 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-06 18:44 -0700
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-07 12:35 +1000
Re: error_t proposal Ike Naar <ike@sdf.lonestar.org> - 2019-09-08 20:15 +0000
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-09 09:30 +1000
Re: error_t proposal Ike Naar <ike@iceland.freeshell.org> - 2019-09-09 07:35 +0000
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-09 19:44 +1000
Re: error_t proposal scott@slp53.sl.home (Scott Lurndal) - 2019-09-09 13:58 +0000
Re: error_t proposal Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-09-10 14:24 +0000
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-11 09:22 +1000
Re: error_t proposal Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-09-10 16:48 -0700
Re: error_t proposal Clifford Heath <no.spam@please.net> - 2019-09-11 10:45 +1000
Re: error_t proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-09-06 21:47 +0100
Re: error_t proposal jadill33@gmail.com - 2019-09-05 07:04 -0700
Re: error_t proposal Thiago Adams <thiago.adams@gmail.com> - 2019-09-05 07:36 -0700
Re: error_t proposal jadill33@gmail.com - 2019-09-05 08:43 -0700
csiph-web