Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #146037

Re: error_t proposal

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: error_t proposal
Date 2019-09-05 20:51 +0100
Organization A noiseless patient Spider
Message-ID <87ftlazfm9.fsf@bsb.me.uk> (permalink)
References (4 earlier) <3a4d5f98-c096-4f3c-b257-f29aefd682a5@googlegroups.com> <d8935dac-9def-422c-b86f-4d2e20569322@googlegroups.com> <052bc6d3-76c2-40b3-8c04-5cc3f63831d9@googlegroups.com> <2c1c2a08-864d-4a0b-ad6c-d6ca7923cf0d@googlegroups.com> <8639fabf-acf5-4de6-9738-d8615c788bdd@googlegroups.com>

Show all headers | View raw


Thiago Adams <thiago.adams@gmail.com> writes:

> On Thursday, September 5, 2019 at 10:37:47 AM UTC-3, Thiago Adams wrote:
> ...
>> Searching at standard I found:
>> 
>> "
>> K.3.6 General utilities <stdlib.h>
>> 1 The header <stdlib.h> defines three types.
>> 2 The types are
>> errno_t
>> which is type int; and
>> "
>> and errno_t is already used!
>
> errno_t was added in C11.
>
> There is also a strerror_s, strerrorlen_s, strnlen_s

All of these are optional.  They are part of the political "annex K".
You can turn them off by having

  #define __STDC_WANT_LIB_EXT1__ 0

before including any header that might define them.

> I compiled this code using visual studio 2019 (latest version)
>
>   FILE* fp = fopen("blablab", "r");
>   if (fp == NULL)
>   {
>     errno_t e1 = errno;
>     printf("File opening error: %s\n", strerror(e1));
>     char errmsg[200];
>     strerror_s(errmsg, 200, e1);
>     printf("File opening error: %s\n", errmsg);
>   }
>
> The number returned is 2 (ENOENT) and the message
> is "No such file or directory".
>
> I found this ENOENT declared inside #include <errno.h>
> but it is not part of C standard.

Yes.  fopen does not "document the use of errno" which means it can do
pretty much anything it likes with it (except set it to zero).
Traditionally, the IO functions make use of this permission, but they
don't have to.

-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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