[cfe-dev] [LLVMdev] New libc++ LLVM Subproject

David Greene dag at cray.com
Tue May 11 21:47:03 PDT 2010


On Tuesday 11 May 2010 19:07:50 Howard Hinnant wrote:

> > This looks cool, but I can't help wondering about the motivation. 
> > libstdc++ has a ton of useful functionality (debug mode, profile mode,
> > etc.).  Does libc++ plan to reproduce that?
> 
> debug mode yes.  It isn't there yet.  And I would like to limit it to being
>  ABI compatible with release mode.  This will entail significant debug
>  functionality curtailment, but also eliminate numerous errors I've seen
>  when debug mode and release mode get accidentally mixed.

Ouch.  I hope libc++ doesn't give up any debug functionality.  It's 
indispensable.  I think the ABI compatibility is worth it, but then I've
never run into significant problems where I've been forced to mix
debug and non-debug mode code.

> > What's driving libc++?
> 
> The possibility of being a superior solution.

Ok, but could that be done by improving libstdc++?

> ----------------
> 
> // Container overhead example

> libc++:
> 
> sizeof map<int, int> = 3
> sizeof deque<int> = 6
> 
> libstdc++:
> 
> sizeof map<int, int> = 6
> sizeof deque<int> = 10
> 
> (smaller is better)

Well, that depends, doesn't it?  Why is libstdc++ larger?  Is any 
functionality being given up by libc++?  If not, why not improve
libstdc++?

> ----------------
> 
> // Adding a few items to a sorted sequence and resorting
> //    (a real world use case)
>
> libc++:
> 
> 5 seconds
> 
> libstdc++:
> 
> 22 seconds
> 
> (smaller is better)

Again, what prevents someone from improving libstdc++ here?

Numbers are good, but context and analysis are even better.
 
> ----------------
> 
> This being said, clang will continue to be std::lib neutral.  If libstdc++
>  meets your needs better than libc++, then you should use it.  libc++ will
>  have to earn its place.

Of course.  That will require some pretty comprehensive analysis.  Right now
I don't know which meets my needs better because we don't yet have an
explanation of what the trade-offs are.

I understand libc++ is new and you're probably not at that point yet, but
a motivating document would help.  Is there are document somewhere that
explains why the project was started in the first place?

                                      -Dave



More information about the cfe-dev mailing list