This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] char_traits error checking
> * testsuite/21_strings/ctor_copy_dtor.cc (test01): Re-enable, now
> that memory limits are in place.
I'd completely forgotten about that chunk of disabled tests. Shame, shame.
Let's go with your approach. Throwing an exception is arguably more C++ish
than assert()ing. This has the added benefit of keeping the tests in one
sane file; my testcase was a separate ctor_null.cc, since it had to abort
and be checked as an XFAIL.
Instead of
__throw_logic_error("attempt to create string with null value");
I recommend
__throw_invalid_argument("attempt to create string with null pointer");
The invalid-argument is more specific, and I can see beginners confusing
"null value" with "empty string" which of course is legit.
Phil
--
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams