Title
§[support.c.headers.other] Ambiguity in the requirements for includes
Status
new
Section
[support.c.headers.other]
Submitter
Alex Mills

Created on 2023-02-09.00:00:00 last changed 20 months ago

Messages

Date: 2023-03-22.22:40:39

Proposed resolution:

This wording is relative to N4928.

  1. Modify [support.c.headers.other] as indicated:

    -1- Every C header other than <complex.h> ([complex.h.syn]), <iso646.h> ([iso646.h.syn]), <stdalign.h> ([stdalign.h.syn]), <stdatomic.h> ([stdatomic.h.syn]), <stdbool.h> ([stdbool.h.syn]), and <tgmath.h> ([tgmath.h.syn]), each of which has a name of the form <name.h>, behaves as if each name placed in the standard library namespace by the corresponding <cname> header is placed within the global namespace scope, except for the functions described in [sf.cmath], the std::lerp function overloads ([c.math.lerp]), the declaration of std::byte ([cstddef.syn]), and the functions and function templates described in [support.types.byteops]. It is unspecified whether these names are first declared or defined within namespace scope ([basic.scope.namespace]) of the namespace std and are then injected into the global namespace scope by explicit using-declarations ([namespace.udecl]). Whether the listed exceptions are included in their corresponding <name.h> headers under the standard library namespace is unspecified.

Date: 2023-03-15.00:00:00

[ 2023-03-22; Reflector poll ]

Set priority to 4 after reflector poll. "The new wording is confusingly inconsistent with the existing wording in that paragraph. Would prefer '... Whether the listed exceptions are declared in the namespace std by their corresponding <name.h> headers is unspecified.'."

Date: 2023-02-09.00:00:00

In [support.c.headers.other], it states that the <name.h> headers behave "as if each name placed in the standard library namespace by the corresponding header is placed within the global namespace scope". There are exceptions for several different definitions in the headers, but it's left ambiguous as to whether their inclusion in the <name.h> headers is required or unspecified.

While it is clear that, for example, ::byte is prohibited, it isn't clear whether std::byte is required to be included at all (this applies to the other listed exceptions as well). Though example 1 makes it appear that their inclusion requirements are meant to be left unspecified, paragraph 1 does not provide clarification. Adding specific wording will ensure this will not be misinterpreted in the future.

To do this, we should append a sentence to [support.c.headers.other] p1:

Whether the listed exceptions are included in their corresponding <name.h> headers under the standard library namespace is unspecified.

History
Date User Action Args
2023-03-22 22:40:39adminsetmessages: + msg13473
2023-02-18 19:34:19adminsetmessages: + msg13411
2023-02-09 00:00:00admincreate