Keith Thompson
2022-11-20 02:08:13 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.
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+***@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */
Keith Thompson (The_Other_Keith) Keith.S.Thompson+***@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */