Skip to content

[cpp.predefined] Contradictory definitions of macros to test for standard extended floating point types #851

@Halalaluyafail3

Description

@Halalaluyafail3

Full name of submitter (unless configured in github; will be published with the issue): Jay Ghiron

Reference (section label): [cpp.predefined]/1

Issue description:

Paragraph 1 begins with:

The following macro names shall be defined by the implementation:

However, in the macro to test for the definition of std::float16_t it says:

__STDCPP_FLOAT16_T__

Defined as the integer literal 1 if and only if the implementation supports the ISO/IEC 60559 floating-point interchange format binary16 as an extended floating-point type ([basic.extended.fp]).

The text appears to say that __STDCPP_FLOAT16_T__ must be defined, then it is only defined as 1 if the implementation supports std::float16_t. There are two possible interpretations of this that I can see: support for std::float16_t is mandatory, or if std::float16_t is not supported then it must be defined but as a value other than one. The former interpretation seems unintended, if it were the case such macros would be entirely useless. The latter interpretation also seems unintended, if it were the case then [stdfloat.syn]/1 would be incorrect.

The same applies to the other macros for the standard extended floating point types.

Suggested resolution:

Move the five macros __STDCPP_FLOAT16_T__, __STDCPP_FLOAT32_T__, __STDCPP_FLOAT64_T__, __STDCPP_FLOAT128_T__, and __STDCPP_BFLOAT16_T__ in [cpp.predefined]/1 to the section below which contains conditional macros. Additionally, for each of these macros change the wording "Defined as the integer literal 1 if and only if" to "Defined, and has the value integer literal 1, if and only if" as in __STDCPP_THREADS__ to forbid definitions with a value other than 1 to indicate a lack of support. Alternatively, add "Otherwise, undefined." after each of theses macros.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions