On 14 Mar 2023, at 10:57 am, Sam Elliott <sam@lenary.co.uk> wrote:
On 13 Mar 2023, at 4:28 pm, Jens Maurer <jens.maurer@gmx.net> wrote:
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.
Thank you for going through the older standards on my behalf, and for filing the LWG issue. I have seen that email, and will follow up on a few more details.
the C library in the toolchain I work on has an `fexcept_t` that is not of integer type.
Which one is that?
The toolchain is Arm Compiler for Embedded (previously also called Arm Compiler). As far as I can see, the `fexcept_t` in our proprietary C library has been a struct since we added support for the `fenv.h` C header in the late 90's.Sam
Jens