This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Core dump constructing a C++ string with NULL
On 14 January 2011 16:19, Tom Browder wrote:
>
> How about a compiler option then, something like
> "--allow-c++-null-string-constructor"...
We throw an exception, std::logic_error, indicating a precondition violation.
Silently ignoring a problem and acting as though a different
constructor was called encourages non-portable code.
It's also an additional maintenance burden, for questionable benefit.
I certainly don't want to have to test my changes to std::string twice
with different builds.
If you don't care about portability you're free to modify the code
yourself for your own use.