This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] char_traits error checking
On Mon, Mar 11, 2002 at 04:45:18PM -0800, Benjamin Kosnik wrote:
> std::string(0);
>
> This cores, at least on x86/linux. I'd think this is something that
> should be avoided, if possible.
It's undefined, so we're allowed to do anything we like, including dump
core. I'd much, much rather throw, however, than treat it as an empty
string. We don't do users any favors by concealing their dependence on
undefined behavior.
Nathan Myers
ncm at cantrip dot org