[patch] empty base class optimization completed in stl_tree.h

Paolo Carlini pcarlini@suse.de
Wed Jan 10 18:49:00 GMT 2007


Howard Hinnant wrote:

>> main trunk:
>>  sizeof(std::set<int>) == 72
>>  sizeof(std::set<int, bool(*)(int, int)>) == 72
>>
>> with patch applied:
>>  sizeof(std::set<int>) == 64
>>  sizeof(std::set<int, bool(*)(int, int)>) == 72
>>
>> Compile tested only.<stl_tree.patch>
>
> I have a question about ABI stability.
>
> Is the reason this is not considered ABI-breaking because std::set is  
> never instantiated within libstdc++?  I.e. we can change std::set all  
> we want and it will never impact the compiled lib.
>
> However consider client A who creates a library which uses std::set 
> in  its interface, and compiles prior to the change above.  Client B  
> compiles after the change above, and links to Client A's library, and  
> say passes a std::set<int> back and forth.  Since the two pieces of  
> code have a different layout for std::set<int>, I would guess that  
> there might be some problems.

Definitely. That's why we have that kind of ("emabrassing") code in 
mainline: the issue has been resolved for the best in v7-branch.

Paolo.



More information about the Libstdc++ mailing list