[libcxx] r180811 - This patch introduces an alternative layout for basic_string which when the string is short, the data pointer will be word-aligned. It can be activated with -D_LIBCPP_ALTERNATE_STRING_LAYOUT. These two different layouts (the default and _LIBCPP_ALTERNATE_STRING_LAYOUT) are not ABI compatible with each other. Once one is chosen for a given platform, it is disruptive to change it.
Sean Silva
silvas at purdue.edu
Tue Apr 30 20:56:26 PDT 2013
On Tue, Apr 30, 2013 at 5:44 PM, Howard Hinnant <hhinnant at apple.com> wrote:
> Author: hhinnant
> Date: Tue Apr 30 16:44:48 2013
> New Revision: 180811
>
> URL: http://llvm.org/viewvc/llvm-project?rev=180811&view=rev
> Log:
> This patch introduces an alternative layout for basic_string which when
> the string is short, the data pointer will be word-aligned. It can be
> activated with -D_LIBCPP_ALTERNATE_STRING_LAYOUT. These two different
> layouts (the default and _LIBCPP_ALTERNATE_STRING_LAYOUT) are not ABI
> compatible with each other. Once one is chosen for a given platform, it is
> disruptive to change it.
>
>
Maybe the name of the #define name should contain "ABI" in it somewhere
just to make it extra clear that it tampers with ABI? It seems a lot less
likely for someone to slip up a flag called
_LIBCPP_ALTERNATE_STRING_LAYOUT_ABI. There aren't many ways to interpret
"layout" other than being ABI breaking, but still, having an easy mental
pattern-match on "ABI" seems a lot less error-prone (the fact that you
explicitly had to mention that this was an ABI choice in the commit message
suggests that it's not entirely obvious).
Also, "alternate" is really vague (and what will you call the next layout
change, "extra alternate"?). Why not
_LIBCPP_WORD_ALIGNED_STRING_LAYOUT_ABI, which is self-documenting?
-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130430/259885ef/attachment.html>
More information about the cfe-commits
mailing list