<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 6 October 2017 at 01:19, Herb Sutter <span dir="ltr">&lt;<a href="mailto:herb.sutter@gmail.com" target="_blank">herb.sutter@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_-4116355874415288409WordSection1"><span class=""><p class="MsoNormal">&gt; why you would not use that alternative in all cases if you want your code to be portable across compilers<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p></span><p class="MsoNormal">Because he wants to use the new better features on those compilers that support them.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">This is important because it’s the only clear motivating use case I’ve heard so far for feature test macros: To encourage aggressive new C++ feature adoption for third-party libraries that do not control their customers’ compiler choice, so that they can adopt a new C++ feature on the compilers that support it, while still working on downlevel (down to C++98) compilers they also have to support.</p></div></div></blockquote><div><br></div><div><br></div><div>Not just third-party libraries but any code that&#39;s built with more than one compiler. A company&#39;s first-party code might get built with different compilers for machines running a different OS, and for example might have a more efficient implementation of something on GNU/Linux compared to Solaris. A standard library implementation might want to enable different features depending on which compiler it&#39;s used with, for example libstdc++ defines deduction guides conditionally on __cpp_deduction_guides, so it can still be used with older Clang releases that don&#39;t support them (arguably this is just a special case of a third-party library, but quite a special one). These are both real world examples.</div><div><br></div><div>Feature test macro are useful! And more useful when all compilers participate in the convention (or the ones that don&#39;t define them still need fragile compiler-specific preprocessor gunk, or the code simply assumes the worst and degrades to the old-style code for those compilers).</div><div><br></div></div></div></div>