[cfe-dev] C++ Language Support Library

Howard Hinnant hhinnant at apple.com
Mon Nov 10 16:23:29 PST 2008


On Nov 10, 2008, at 6:54 PM, Chris Lattner wrote:

> On Nov 10, 2008, at 3:00 PM, Doug Gregor wrote:
>>> For a random linux distro, for example, it would be fine to compile
>>> libstdc++ with GCC, and clang should be able to work with it.
>>>
>>> I think that retaining compatibility with libstdc++ would be a very
>>> worthwhile goal (as is supporting the apache library, stlport, and/ 
>>> or
>>> whatever other ones exist, where reasonable).  What is the cost of
>>> doing
>>> this?  Does it use crazy GCC extensions that we don't want to
>>> implement?
>>
>> libstdc++ aims to be pretty standard-conforming, and they avoid most
>> crazy GCC extensions. As Sebastian noted, in GCC 4.3 and newer are
>> using some C++0x features in their TR1 implementation. The biggest
>> feature there is variadic templates, which---while not trivial--- 
>> isn't
>> terribly hard to implement if the template system itself is designed
>> well.
>
> Ok! I agree with Sebastian that libstdc++ support will be critical for
> clang C++ adoption.  While libstdc++ *is* a moving target, picking a
> very specific one (say, GCC 4.2's) should be useful enough in the
> short term, and doesn't require an '0x support to handle.  I picked
> 4.2 specifically because it is used on the mac, but any other
> reasonable one would be good.

For libstdc++ 4.2 we will need support for "strong using" attributes  
with the following extension syntax:

namespace std
{
   namespace _6 { }
   using namespace _6 __attribute__ ((strong));
}

This is a C++0X feature which will have C++0X syntax more like:

namespace std
{
   inline namespace _6
   {
       /*... declarations and definitions*/
   }
}

Because of the structure of gcc 4.2, I believe both syntaxes will  
ultimately need to be supported, but initially, only the gcc 4.2  
syntax.  I.e. I don't believe the library can transform one syntax to  
the other with macros (but I could be wrong).

-Howard




More information about the cfe-dev mailing list