On Friday, 20 December 2013 10:00:43 CEST, Martin Vaeth wrote:
The example with string reference-counters which you gave is IMHO
typical;
one would really need to write strange code to make it work *with*
reference
counters but break without. Hard to believe that this happens in
practice.
What *will* happen in practice is that the execution speed changes
(probably
getting slower, but there might also be exceptions).
You have not considered the implications of the updated requirements. With std::string, this might be hard to understand within all the layers of template wrapping, but consider std::list instead.
The "old" (C++98/C++03) std::list is implemented by containing exactly one member, the struct _List_node_base. This struct has exactly two pointers inside, one for the next item and one for the last. This layout cannot be changed without breaking the binary compatibility; it is effectively made public because GCC's standard library does not use the PIMPL idiom.
Now, this particular layout (which we just established cannot be changed without breaking the ABI) means that std::list::size() has O(n) time cost simply because it has to traverse the whole list to compute the number of items. The C++11 standard, however, mandates the time complexity to be O(1). This means that there will be a very visible change, at least for std::list. I won't speculate on how the upstream is going to solve this, but I do not expect that the end result will allow linking a translation unit built for C++98 by GCC <= 4.8 with one built for C++11 by the new compiler.
Jan
