From: redi Achieving link- and run-time coexistence is not a trivial
implementation task. To achieve this goal we required a small
extension to the GNU C++ compiler (described in the GCC Manual for
- C++ Extensions, see strong
+ C++ Extensions, see strong
using), and a complex organization of debug- and
release-modes. The end result is that we have achieved per-use
recompilation but have had to give up some checking of the
std::basic_string
class template (namely, safe
iterators).
+Compile-time coexistence of release- and
debug-mode components
@@ -415,10 +416,10 @@ release-mode or a debug-mode string. In practice, this results in
runtime errors. A simplified example of this problem is as follows.
Take this translation unit, compiled in debug-mode:
+
Take this translation unit, compiled in debug-mode:
// -D_GLIBCXX_DEBUG -#include+#include <string> std::string test02(); @@ -437,7 +438,7 @@ int main() ... and linked to this translation unit, compiled in release mode:
-#include+#include <string> std::string test02() @@ -467,7 +468,7 @@ test02() They have virtual functions returning strings: these functions mangle in the same way regardless of the mangling of their return types (see above), and their precise signatures can be relied upon - by users because they may be overridden in derived classes. + by users because they may be overridden in derived classes. With the design of libstdc++ debug mode, we cannot effectively hide @@ -509,7 +510,7 @@ test02() reuse the
Allocator
template parameter of containers by adding a sentinel wrapperdebug<>
that signals the user's intention to use debugging, and pick up - thedebug&lr;>
allocator wrapper in a partial + thedebug<>
allocator wrapper in a partial specialization. However, this has two drawbacks: first, there is a conformance issue because the default allocator would not be the standard-specifiedstd::allocator<T>
. Secondly @@ -531,7 +532,7 @@ test02() namespaces. See this post - + This method fails the correctness criteria.Extension: allow reopening on namespaces: This would @@ -546,7 +547,6 @@ test02() objects! This solution would fails the minimize recompilation requirement, because we would only be able to support option (1) or (2). -Extension: use link name: This option involves complicated re-naming between debug-mode and release-mode @@ -561,7 +561,6 @@ test02() See link name -Other options may exist for implementing the debug mode, many of