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


Groups > comp.std.c > #6451

Invalid sample definition for errno

Path csiph.com!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
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> (permalink)
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=
Xref csiph.com comp.std.c:6451

Show key headers only | View raw


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 */

Back to comp.std.c | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Invalid sample definition for errno Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-11-19 18:08 -0800
  Re: Invalid sample definition for errno Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-11-20 05:26 -0800
    Re: Invalid sample definition for errno Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-11-20 13:58 -0800

csiph-web