http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51653

--- Comment #2 from Marc Glisse <marc.glisse at normalesup dot org> 2011-12-24 
22:25:51 UTC ---
(In reply to comment #1)
> I'm not yet convinced we want to apply it,

Hi,

just so I know, what part are you not convinced about?
1) that we want a library solution? it is just a proof of concept, I would be
happy with a compiler solution (although it might still require a library
rewrite so it can be applied).
2) that we want a more compact tuple? sizeof(tuple<char,tuple<char,int>>) is
currently 16, that's twice as much as necessary (in case someone wonders, the
unexpected extra 4 is there for the same reason that tuple<tuple<tuple<int>>>
has size 12, ie derivation from the empty tuple<>).

Note that it is not obvious how to efficiently (you can't try all n! orders...)
determine the best layout. In the code I just put all the empty types first and
then the rest sorted by decreasing alignment, but that heuristic is not optimal
for several reasons:
- there can be hidden empty types in the bigger types
- if we use derivation also for non-empty types, the size (without tail
padding) is not a multiple of the alignment anymore and the heuristic doesn't
make much sense anymore.

Reply via email to