Is there any C compiler(s) which defines both __STDC__
and __STDC_IEC_559__
to 1?
If so, then which one(s)?
Reason of the question: as far as I can test (April 2021), none of the latest versions of popular C compilers (gcc, clang, msvc) define both __STDC__
and __STDC_IEC_559__
to 1. Hence, these compilers may generate executable files, which produce non-IEEE 754 conformant results. However, there is a demand on such C compilers, which actually provide a guarantee / confidence that generated executable files produce IEEE 754 conformant results (under strict
floating-point model option).
Yes. It turned out that in gcc and clang definition of __STDC_IEC_559__
depends on the host OS. In case of Windows: __STDC_IEC_559__
is 0
. In case of Linux: __STDC_IEC_559__
is 1
.
Here are the options to get both __STDC__
and __STDC_IEC_559__
defined to 1
:
clang -std=c11 -ffp-model=strict
gcc -std=c11 -frounding-math -fsignaling-nans
UPD20211229: Intel C compiler defines both __STDC__
and __STDC_IEC_559__
to 1
:
icc -std=c11 -fp-model=strict