C++ Logo

std-discussion

Advanced search

Re: [cfenv] Question about C++'s std::fexcept_t vs C's fexcept_t

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Mon, 13 Mar 2023 17:28:33 +0100
On 13/03/2023 14.49, Sam Elliott via Std-Discussion wrote:
> I have noticed a discrepancy between the C++ standard's description of `<cfenv>` and the C standard's description of <fenv.h>:
>
> Specifically, in the current C++ working draft: https://eel.is/c++draft/cfenv <https://eel.is/c++draft/cfenv>, `std::fexcept_t` is denoted as being of "integer type", but the C standards I could find only say: "The type fexcept_t represents the floating-point status flags collectively, including any status the implementation associates with the flags", which by my reading doesn't require the type to be of integer type.
>
> I'm not sure where the discrepancy has come from in this case. Is there some history I'm missing for the C++ definition of `std::fexcept_t`, which might explain the discrepancy?

This is the way it is since N2009 (the April, 2006 Working Draft).

This is when <cfenv> was added; the prior working draft N1905 didn't
have that header.

<cfenv> came to the standard via section 8.6 of
Technical Report on C++ Library Extensions

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf

Section 8 of that TR was voted into the C++ Working Draft in Berlin
(April 2006).

<cfenv> went into the TR via N1568

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1568.htm
with some rationale in N1354
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1354.htm

but C99, as you correctly observe, doesn't mention "integer type".

I've submitted an LWG issue and copied you on it.

> the C library in the toolchain I work on has an `fexcept_t` that is not of integer type.

Which one is that?

Jens

Received on 2023-03-13 16:28:41