Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

If it's worth hacking on well, it's worth hacking on for money.


devel / comp.std.c / Invalid sample definition for errno

SubjectAuthor
* Invalid sample definition for errnoKeith Thompson
`* Invalid sample definition for errnoTim Rentsch
 `- Invalid sample definition for errnoKeith Thompson

1
Invalid sample definition for errno

<87r0xyl6nm.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=867&group=comp.std.c#867

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.std.c
Subject: Invalid sample definition for errno
Date: Sat, 19 Nov 2022 18:08:13 -0800
Organization: None to speak of
Lines: 25
Message-ID: <87r0xyl6nm.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="542c9bd86dcad9131c7660300d8ef3f5";
logging-data="3515908"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8qg02N6RKYeTkVmUAeGqn"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:WSP0aWfDbrsjK9I2TMfFQ2VBO5w=
sha1:Y9CqurH0ESZXrPMQKptTgklgiCs=
 by: Keith Thompson - Sun, 20 Nov 2022 02:08 UTC

A footnote in the section describing <errno.h> says:

The macro errno need not be the identifier of an object. It might
expand to a modifiable lvalue resulting from a function call (for
example, *errno()).

Footnotes are non-normative, and this one is presumably intended to be
informal, but that's not a valid macro definition for errno, both
because it's not fully protected by parentheses and because the function
can't be named "errno".

A valid definition (and the one used by glibc) is:

# define errno (*__errno_location ())

I suggest the footnote should be updated to use something like that
(though it needn't show the entire #define directive).

The same wording appears starting in C90 and up to and including the
latest C23 draft.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */

Re: Invalid sample definition for errno

<86sfidbvu7.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=868&group=comp.std.c#868

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.std.c
Subject: Re: Invalid sample definition for errno
Date: Sun, 20 Nov 2022 05:26:40 -0800
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <86sfidbvu7.fsf@linuxsc.com>
References: <87r0xyl6nm.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="a724f5b4ee1d34e760f89c516bf20c9c";
logging-data="3707309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hq+1sDxOG7b1HDH4SrnWse70/jlM7qVU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:fF6s1XfIVeEWXOCEg8kxY0UXKIY=
sha1:2yBnZEF+2pOv+YKixHVM9WHmU8s=
 by: Tim Rentsch - Sun, 20 Nov 2022 13:26 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> A footnote in the section describing <errno.h> says:
>
> The macro errno need not be the identifier of an object. It might
> expand to a modifiable lvalue resulting from a function call (for
> example, *errno()).
>
> Footnotes are non-normative, and this one is presumably intended to be
> informal, but that's not a valid macro definition for errno, both
> because it's not fully protected by parentheses and because the function
> can't be named "errno".

I see no reason the function couldn't be named "errno".

Re: Invalid sample definition for errno

<87edtxl24c.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=869&group=comp.std.c#869

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.std.c
Subject: Re: Invalid sample definition for errno
Date: Sun, 20 Nov 2022 13:58:27 -0800
Organization: None to speak of
Lines: 30
Message-ID: <87edtxl24c.fsf@nosuchdomain.example.com>
References: <87r0xyl6nm.fsf@nosuchdomain.example.com>
<86sfidbvu7.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader01.eternal-september.org; posting-host="542c9bd86dcad9131c7660300d8ef3f5";
logging-data="3792105"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/IYYPkv0D7oghrj7tAiYKE"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:7l7JWuwk5MSVAjQci6c+ZTAabYc=
sha1:y4DiyyYSb0R5ra7VckmhVMeojsw=
 by: Keith Thompson - Sun, 20 Nov 2022 21:58 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> A footnote in the section describing <errno.h> says:
>>
>> The macro errno need not be the identifier of an object. It might
>> expand to a modifiable lvalue resulting from a function call (for
>> example, *errno()).
>>
>> Footnotes are non-normative, and this one is presumably intended to be
>> informal, but that's not a valid macro definition for errno, both
>> because it's not fully protected by parentheses and because the function
>> can't be named "errno".
>
> I see no reason the function couldn't be named "errno".

My thought was that giving the function and the macro the same name
would cause a conflict, and I thought I had an example that demonstrated
it. Looking again, I was mistaken:

If the name of the macro being replaced is found during this scan of
the replacement list (not including the rest of the source file’s
preprocessing tokens), it is not replaced.

I still suggest that using the same name for both is needlessly
confusing.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor