[cfe-dev] Curious about libcxx __libcpp_nmstr design

Howard Hinnant howard.hinnant at gmail.com
Tue Oct 8 17:27:44 PDT 2013


On Oct 8, 2013, at 1:35 PM, Yaron Keren <yaron.keren at gmail.com> wrote:

> I have couple of questions about __libcpp_nmstr class design. 
> 
> It's a reference counted char* class optimized for size, right?
> 
> Why is this so important to optimize this class size to the absolute minimum?
> 
> What is the purpose of the two unused_t? (I understand they are named unused...) 
> Why they are assigned the string length if never used?

libcxx/libcxxabi were created as replacements for gcc's-4.2 libstdc++.  The intent is that all exception classes defined in <stdexcept> be ABI compatible with libstdc++-4.2 so that if an application found itself using both libc++ and libstdc++ (indirectly via various dylibs) that a std-defined exception propagated by one library could be caught by another, without worry about whether either library was linked against libstdc++ or libc++.  In most recent work, the definitions for these types have migrated to libc++abi (http://libcxxabi.llvm.org), so that libc++abi can serve both libc++ and libstdc++, assuming libstdc++ has been ported to run on top of libc++abi.

Howard





More information about the cfe-dev mailing list