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 12:40:26PM +0200, Paolo Carlini wrote:

> Jonathan Wakely wrote:
> 
> >I don't know how to do this cleanly in Doug's debug framework.
> >This check in string::operator[] needs to test pos < size in pedantic
> >mode but pos <= size otherwise:
> >
> >       _GLIBCXX_DEBUG_ASSERT(__pos < size());
> >
> >Maybe we need something like this
> >
> >#ifdef _GLIBCXX_DEBUG_PEDANTIC
> >#define _GLIBCXX_DEBUG_STRING_ELEMENT_ACCESS(A) \
> >    _GLIBCXX_DEBUG_ASSERT(__pos < size())
> >#else
> >#define _GLIBCXX_DEBUG_STRING_ELEMENT_ACCESS(A) \
> >    _GLIBCXX_DEBUG_ASSERT(__pos <= size())
> >#endif
> >  
> >
> I think something simpler would also do, since there is only *one*
> occurrence, right?
> Right in operator[]:
>    
>     #ifdef _GLIBCXX_DEBUG_PEDANTIC
>         _GLIBCXX_DEBUG_ASSERT(__pos < size())
>     #else
>         _GLIBCXX_DEBUG_ASSERT(__pos <= size())
>     #endif

Yes, it's only needed in that one place. I was trying to make the #if
hidden away inside <debug/debug.h> but if that's not a concern your
version is much better.

<debug/string> should also be changed to support it, although that file
is never used unless you include it explicitly; basic_string is always
in namespace std (not __gnu_norm) even when using debug mode.

jon


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