[SG10] Feature test macros: always available, or in a header?

Nelson, Clark clark.nelson at intel.com
Tue May 7 22:19:55 CEST 2013


Also, if people are concerned about startup-time cost, it would be nice if we had some actual numbers quantifying that cost, on which we could base trade-offs.

Clark

> -----Original Message-----
> From: features-bounces at open-std.org [mailto:features-bounces at open-
> std.org] On Behalf Of John Spicer
> Sent: Tuesday, May 07, 2013 1:01 PM
> To: Richard Smith
> Cc: features at isocpp.open-std.org
> Subject: Re: [SG10] Feature test macros: always available, or in a
> header?
> 
> I'm not personally fond of that direction.
> 
> At least for EDG, and I suspect others, the set of feature supported is
> going to depend on command-line options, which would mean that we'd have
> to define one set of macros (or something) to allow the <features>
> header to define another set.   It also makes it more likely that you
> could have a <features> file that doesn't actually match what the
> compiler does.
> 
> John.
> 
> On May 7, 2013, at 3:17 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> 
> > Hi,
> >
> > Has any thought been given to putting the feature-test macros into an
> implementation-supplied header, instead of predefining them? This would
> allow us to remove the cost associated with predefining these macros,
> for translation units which don't need them. Instead, we could supply a
> single predefined macro indicating whether the header is available, and
> user code would write something like:
> >
> > #ifdef __cpp_lib_header_features
> > #include <features>
> > #endif
> >
> > #ifdef __cpp_relaxed_constexpr
> > constexpr
> > #endif
> > size_t strlen(const char *p) { /* ... */ }
> >
> > ... and so on.
> > _______________________________________________
> > Features mailing list
> > Features at isocpp.open-std.org
> > http://www.open-std.org/mailman/listinfo/features
> 
> _______________________________________________
> Features mailing list
> Features at isocpp.open-std.org
> http://www.open-std.org/mailman/listinfo/features


More information about the Features mailing list