Re: Replacement for MS STL?
"Garry W" <ListMail3@extremelyserious.org> wrote in message
Pardon the pause in replying. It was one of those weeks where the code
started flowing =really= well...
Here's one of the STL bugs things I found. Rather inelegantly and rapidly
(This was discussed here recently, but only after I had to find it on my
Background: Because I'm dealing with a huge data collection, I had been
compiling most of my program "Release", for needed speed, while compiling
only the bit that I'm actively working on as "Debug". Fair enough. But,
recently discussed here, the slimly-documented switch
- and, in particular, the completely-undocumented changing memory layout
depends on _DEBUG/NDEBUG - can cause all he.. to break loose when you mix
modes. Because the switch triggers different, incompatible, memory layouts
By "undocumented" (it could be argued that the lack of documentation is
real bug here)
Then it's not a bug. There are *oodles* of macros and names beginning
with an underscore and a capital letter in the Standard C++ library.
Clause 17 of the C++ Standard tells you that these are part of the
implementation. Attempting to fiddle with such names, or second guess
how you might change them, is a dangerous and unsupported exercise.
Nothing in those words would lead me to suspect that _DEBUG and NDEBUG
template-library code might be unmixable. Nothing at all is mentioned
C++ or the C++ STL.
Well, they are. Perhaps Microsoft's top-level documentation might
make such things clearer for beginners, but I'm astounded that a
putative expert would think it wise to mix libraries compiled with
My workaround is now to completely delete the _DEBUG and NDEBUG symbols
my projects, while hoping that there are not any other ways for the MS
headers to behave differently in "Debug" and "Release" modes.
I love the existence of iterator debugging. Nice idea - the default
lend themselves to mistakes. My suggested fix would simply be to have the
user explicitly turn the feature on and off, rather than doing it by
There are compiler switches for doing just that.
PS - There have been rumors that the MS "_DEBUG" C++ operator-new/delete
incompatible with the MS "NDEBUG" C++ operator-new/delete. Are the rumors
Dunno. That's not my diocese.
(It would be simple to make the debug/release heap calls mutually mixable
compatible (at a "normal case" cost of, hmmmmm.... one memory 'read' and
three Intel instructions) but I do not know whether Microsoft has chosen
It ain't that simple.