[cfe-dev] Can we make libcxx headers more modular for faster compilation?

Reid Kleckner rnk at google.com
Thu Oct 3 11:15:32 PDT 2013


OK.  :)  We should avoid including windows.h from public headers anyway.


On Thu, Oct 3, 2013 at 11:50 AM, Lars Viklund <zao at acc.umu.se> wrote:

> On Thu, Oct 03, 2013 at 08:10:18AM +0200, Jonathan Sauer wrote:
> > Hello,
> >
> > > support.h includes windows.h on win32 platform.
> > > Does libstdc++ also include windows.h. I think this single include may
> be enough to explain the difference.
> >
> > I just looked into libc++, and it seems to include windows.h without
> first defining
> > WIN32_LEAN_AND_MEAN. From <http://support.microsoft.com/kb/166474>:
> >
> > | WIN32_LEAN_AND_MEAN: Windows Headers use this symbol to exclude
> rarely-used header files
> >
> > Maybe that's a way to speed things up a bit, at least on Windows.
>
> No. NO. NEVER DO THIS.
>
> Defining that macro forces every single user of the Windows API to
> always include the Windows.h header themselves before you do, lest they
> will forever lose all ability to use very fundamental types in the
> Windows headers.
>
> That macro is for end user use only, and shall only be defined when all
> participating users agree on its use.
>
> "rarely-used" doesn't help the bloke that actually wanted to use HDROP
> or niche libraries like the ATL or WTL in that TU.
>
> If it's in your private libc++ library TUs, sure. But if it has _any_
> chance of leaking out into other code? No. Just don't.
>
> --
> Lars Viklund | zao at acc.umu.se
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131003/a7a21cf8/attachment.html>


More information about the cfe-dev mailing list