More Thoughts on Implementing errno as a Macro

WG 14 Document numberN1338
Date2008-04-25
ProjectProgramming Language C
ReferenceISO/IEC IS 9899:1999
Reply toNick Stoughton
USENIX Association
nick@usenix.org

Background

SC22 WG14 N1257 describes an inconsistency in the wording for <errno.h>. N1308 followed up proposing changes in wording to both C and C++ to bring them into alignment with POSIX, allowing errno to be implemented as either a macro or an identifier with external linkage.

Following discussions with both the C and C++ committees, it is clear that the cost of requiring it to be defined as a macro is infinitesimally small, since in the worst case it simply requires
#define errno errno

In the vast majority of known implementations, errno is already a macro.

To that end, this proposal seeks to clarify the wording in the C standard to force errno to be defined as a macro.

Proposed wording for C

In 7.5 paragraph 2, delete the penultimate sentence:

It is unspecified whether errno is a macro or an identifier declared with external linkage.