This is the mail archive of the
mailing list for the libstdc++ project.
Re: [patch] Remove invalid test on non-const empty strings
On Fri, Jan 21, 2005 at 11:02:50AM +0100, Paolo Carlini wrote:
> chris jefferson wrote:
> >Good point!
> >Perhaps then a better idea would be to wrap tests like this in a
> >#ifndef _GLIBCXX_DEBUG / #endif pair?
> Better, but I think we should really understand (I'm speaking for
> myself, first and foremost ;) why the debug mode is so strict about that
N.B. This is only my interpretation of the situation, having spent a
fair bit of time fixing up the testsuite for debug mode...
Debug mode was written to the letter of the standard, not including any
v3 extensions. IMHO this makes it very useful, in the same way as
-ansi -pedantic, for checking you haven't made any assumptions that
aren't guaranteed by the standard.
If your code fails in debug mode but works otherwise it implies you've
made non-portable assumptions or relied on GCC extensions or
implementation-defined behaviour (such as accessing  on an empty
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
- Brian W. Kernighan