DOC: notes regarding the current level of C++11 support

This commit is contained in:
Fischlurch 2014-09-13 04:55:57 +02:00
parent 0ff5c50030
commit 177eb0fab3

View file

@ -93,3 +93,47 @@ ASCII 'A' = 65 defined: 1 undefd; 0 bool-convertible: 0 can build bool: 1 bool f
----
Known bugs and tricky situations
--------------------------------
Summer 2014::
the basic switch to C++11 compilation is done by now, but we have yet to deal with
some ``ripple effects''.
September 2014::
and those problems turn out to be somewhat insidious: our _reference system_ is still Debian/stable,
which means we're using *GCC-4.7* and *CLang 3.0*. While these compilers both provide a roughly complete
C++11 support, a lot of fine points were discovered in the follow-up versions of the compilers and standard
library -- current versions being GCC-3.9 and CLang 3.4
* GCC-4.7 was too liberal and sloppy at some points, where 4.8 rightfully spotted conceptual problems
* CLang 3.0 turns out to be really immature and even segfaults on some combinations of new language features
* Thus we've got some kind of a _situation:_ We need to hold back further modernisation and just hope that
GCC-4.7 doesn't blow up; CLang is even worse, Version 3.0 us unusable after our C++11 transition.
We're forced to check our builds on Debian/testing, and we should consider to _raise our general
requirement level_ soon.
Perfect forwarding
~~~~~~~~~~~~~~~~~~
The ``perfect forwarding'' technique in conjunction with variadic templates promises to obsolete a lot of
template trickery when it comes to implementing custom containers, allocators or similar kinds of managing wrappers.
Unfortunately, we ran into nasty problems with both GCC-4.7 and CLang 3.0 here, when chaining several forwarding calls.
- the new _reference collapsing rules_ seem to be unreliably still. Note that even the standard library uses an
overload to implement `std::forward`, while in theory, a single definition should work for every case.
- in one case, the executable generated by GCC passed a reference to an temporary, where it should have
passed a rvalue reference (i.e. it should have _moved_ the temporary, instead of referring to the
location on stack)
- CLang is unable to pass a plain-flat rvalue through a chain of templated functions with rvalue references.
We get the inspiring error message ``binding of reference to type `std::basic_string<char>` to a value of
type `std::basic_string<char>` drops qualifiers''
Thus -- as of 9/2014 -- the _rules of the game_ are as folows
- it is OK to take arguments by rvalue reference, when the type is explicit
- it is OK to use std::forward _once_ to pass-trough a templated argument
- but the _time is not yet ready_ to get rid of intermediary copies
- we still prefer returning by value (eligible for RVO) and copy-initialisation
- we refrain from switching our metaprogramming code from Loki-Typelists and hand-written specialisations
to variadic templates and `std::tuple`