[RFC] Strange line at the end of _M_mutate
Phil Edwards
pedwards@disaster.jaj.com
Mon Dec 17 14:41:00 GMT 2001
On Sun, Dec 16, 2001 at 07:34:36PM +0000, Nathan Myers wrote:
> On Sun, Dec 16, 2001 at 05:37:27PM +0100, Paolo Carlini wrote:
> >
> > _M_data()[__new_size] = _Rep::_S_terminal; // grrr. (per 21.3.4)
> > // You cannot leave those LWG people alone for a second.
>
> At the last meeting before the standard was released, while I was not
> present, the LWG elected to abandon the principle in order to allow
> overindexing strings by one character, to "preserve" C-like code that
> relies on a null sentinel rather than checking the string index.
>
> It was one of a series of radical changes adopted on the flimsiest of
> premises at the last minute, sacrificing all the care that had gone
> into the earlier decisions.
In one of my local trees, I have
#ifndef _GLIBCPP_THUMB_NOSE_AT_LWG
_M_data()[__new_size] = _Rep::_S_terminal; // grrr. (per 21.3.4)
// You cannot leave those LWG people alone for a second.
#endif
surrounding bits of code that many people feel should be on (or off) by
default, contrary to what the standard says. Mostly as an experiment to
see if any testcases broke, or suddenly started working, or if benchmarks
suddenly got faster, etc.
I think I also have the ifstream::open() code guarded like that, and in
nose-thumbing mode it clears the state flags instead of obeying DR 22.
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
More information about the Libstdc++
mailing list