Authors: Jay Ghiron
Date: 2026-11-12
Submitted against: C23
Status: Open
For most global state in the standard, it is specified that they will not be arbitrarily changed by the implementation. However, there is one exception:
#pragma STDC FENV_ACCESS ON
#include<fenv.h>
int main(){
/* could <fenv.h> have disabled FENV_ACCESS? */
}
There does not appear to be anything that forbids <fenv.h> from
doing:
#pragma STDC FENV_ACCESS OFF
Should wording be added that prohibits this? This also applies to
macros since they can use _Pragma, both predefined and in the
standard library. Though the standard pragmas have restrictions on
their placement, so for that to be possible the implementation would
need to be less restrictive or provide an alternative pragma that is
less restrictive. Those same restrictions also make it impossible for
a strictly conforming program to use _Pragma in a macro argument to
a standard library macro, so a general requirement about not
containing any standard pragmas should be fine even for function-like
macros in the standard library.
The above examples use FENV_ACCESS and <fenv.h> as an example,
though this applies to all standard pragmas and all standard headers.