<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">In C++11 and above, C99/C11 features should be available even when using C++. For example, FLT_HAS_SUBNORM should be provided by <float.h>:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">    $ cat <<EOF | clang++ -xc++ -std=c++11 -</font></div><div class=""><font face="Monaco" class="">    #include <float.h></font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">    #ifndef FLT_HAS_SUBNORM</font></div><div class=""><font face="Monaco" class="">    #   error "FLT_HAS_SUBNORM is missing"</font></div><div class=""><font face="Monaco" class="">    #endif</font></div><div class=""><font face="Monaco" class="">    EOF</font></div><div class=""><br class=""></div><div class="">This should also work when including `<cfloat>`. However, this currently:</div><div class="">- fails in -std=c++11 or above</div><div class="">- succeeds in -std=gnu++11 or above</div><div class="">- succeeds in -std=c11 or above</div><div class="">- succeeds in -std=gnu11 or above</div><div class=""><br class=""></div><div class="">If I understand correctly, the problem is that we currently have the following in clang/lib/Headers/float.h:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">    #include_next <float.h> // pick up whatever the system provides</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">    ...</font></div><div class=""><font face="Monaco" class="">    #undef FLT_HAS_SUBNORM // undefine what the system provides</font></div><div class=""><font face="Monaco" class="">    ...</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">    // redefine our own version of the macro</font></div><div class=""><font face="Monaco" class="">    #if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)</font></div><div class=""><font face="Monaco" class="">        ...</font></div><div class=""><font face="Monaco" class="">    #  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__</font></div><div class=""><font face="Monaco" class="">        ...</font></div><div class=""><font face="Monaco" class="">    #endif</font></div><div class=""><br class=""></div><div class="">The #if block checks whether we're compiling in C11 or above, or whether we're compiling in a non-strict dialect (basically some any gnuXXX dialect). However, it doesn't check for strictly conforming C++, and as a result we don't get the definitions. I'd like to know what's the right strategy for providing these definitions in C++, and whether there's an established way of doing this already. Naively, changing the #if to</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">    #if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || (defined(__cplusplus) && __cplusplus >= 201103L)</font></div><div class=""><font face="Monaco" class="">        ...</font></div><div class=""><font face="Monaco" class="">    #  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__</font></div><div class=""><font face="Monaco" class="">        ...</font></div><div class=""><font face="Monaco" class="">    #endif</font></div><div class=""><br class=""></div><div class="">seems to do the job. But I'm not very familiar with how Clang's headers are imbricked into libc++ and how they interact with per-platform headers, so I'm asking here.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Louis</div><div class=""><br class=""></div></body></html>