This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Apply DR434 resolution to <debug/bitset>


On Fri, May 06, 2005 at 02:27:47PM +0200, Paolo Carlini wrote:

> Jonathan Wakely wrote:
> 
> >So apart from PR 16021 there's nothing serious.
> >  
> >
> Ah, ok, thanks a lot!
> 
> Then, let's figure out the cleanest solution string/element_access...
> I'm tempted to go with my simple #ifdef but want to give this a little
> more thought...

It seems obvious now I look at it:

      reference
      operator[](size_type __pos)
      {
        _GLIBCXX_DEBUG_PEDASSERT(__pos < size());
        // allow v3 extension when not in pedantic mode:
        _GLIBCXX_DEBUG_ASSERT(__pos <= size());
        _M_leak();
        return _M_data()[__pos];
      }

This does the check twice in pedantic mode, but that's not a problem.

BUT while checking that I noticed a serious problem with pedantic mode,
see attached patch.  This is wrong in 3.4, 4.0 and mainline, and makes
it rather difficult to test the above fix for std::string, since I was
never activating pedantic mode!  :)

2005-05-10  Jonathan Wakely

	* include/debug/debug.h: Fix typo in macro name.

OK for mainline and 4.0 ?  What about 3.4 ?

jon

-- 
"No one pretends that democracy is perfect or all wise.
 It has been said that democracy is the worst form of government,
 except for all the others that have been tried from time to time."
	- Winston Churchill, 1947.

Attachment: libstdcxx-debug_mode_pedantic_check.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]