[Development] __has_include vs GCC

Thiago Macieira thiago.macieira at intel.com
Thu Feb 9 02:21:44 CET 2017


On quarta-feira, 8 de fevereiro de 2017 23:52:03 PST Stephen Kelly wrote:
> Marc Mutz wrote:
> > Hi,
> > 
> > I just filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79433
> > complaining that __has_include returns true for headers which then, when
> > included, #error out about the wrong C++ standard used.
> 
> In my opinion, the problem is sd-6 defining feature macros in the header
> that contains the implementation, instead of in a single header.
> 
> There are many reasons not to do that, but the opinion of the chair is
> bonkers and no one else has an opinion:
> 
>  https://www.mail-archive.com/features@isocpp.open-std.org/msg00018.html
> 
>  https://www.mail-archive.com/features@isocpp.open-std.org/msg00162.html

I don't agree with you, mostly because I don't understand what the issue is. 
And it's not the issue Marc is having.

The way I see it, macros defined inside a file are not an issue, if the file has 
been there for 20 years. There's no harm in #include'ing it. Some features are 
the entire new file, so that's what #if __has_include is for.

The issue Marc has is that the way to tell that a feature exist *is* the 
__has_include, but once you do that, you get an #error.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list