Previously, those #defines were only provided in C or when GNU extensions were
enabled. We need those #defines in C++11 and above, too.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
I'll ship this. @eli.friedman I think this is your playground -- if you want any changes to happen post-review, please LMK and I will gladly cooperate.
Formally, I don't think C11 is a normative reference for C++11 or C++14, only C++17 (see [intro.refs] in the standard).
Right, this was changed in wg21.link/p0063r3
That being said, we *can* offer these C11 features as extensions IIUC.
You're right. I don't mind submitting a patch that enables it for C++17 and above only if that's what you want, however...
Right, this was changed in wg21.link/p0063r3
That being said, we *can* offer these C11 features as extensions IIUC.
... I think it's also fine to have it in C++11.
Your choice, @eli.friedman
In C++11, this is technically valid:
#define FLT_TRUE_MIN 1 #include <cfloat> #if FLT_TRUE_MIN != 1 #error float.h redefined my macro #endif
and likewise
#include <cfloat> constexpr float FLT_TRUE_MIN = 0.0001f;
... but both will fail with this patch, so providing these macros is technically non-conforming. I don't know to what extent we should care about such uses, though. We generally leak additional non-conforming names from the system <*.h> headers into the user's namespace if the libc headers put them there. This would, however, probably be the first time that we put them there ourselves.
I agree with the comments. I think we should strive to be strictly conforming. I make that argument all the time for libc++, so I'll be consistent :-).