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

Jonathan Wakely cow@compsoc.man.ac.uk
Fri May 6 10:23:00 GMT 2005


On Fri, May 06, 2005 at 12:10:22PM +0200, Paolo Carlini wrote:

> Jonathan Wakely wrote:
> 
> >Found this while looking at the vector<bool> issue I posted earlier.
> >
> >The resolution to DR434 was not applied to <debug/bitset> which causes
> >testsuite/23_containers/bitset/to_string/1.cc to FAIL in debug mode.
> >
> >The attached patch fixes the FAIL on 4.0 and mainline, OK for both?
> >(DR434 resolution is not on the 3.4 branch)
> >  
> >
> Yes, it's ok.

Thanks. Will commit later today.

> By the way, what happened of that discussion about debug-pedantic vs
> basic_string? Shall we have a consistent policy about that? In any case,
> I don't think this is a case where that distinction is important, but if
> we (meaning, at least, me and you ;) really want zero failures in
> debug-mode we should start telling apart testcases having to do with
> details of our implementation from testcases simply enforcing the letter
> of the standard.

That's how I noticed that most of the 21_strings tests aren't running on
my system, I wasn't seeing the element_access/char/empty.cc FAIL on
mainline, only on 4.0

A temporary workaround would be to disable the non-const part of the
tests that fail, but that's just pretending the problem's gone away.

The ideal solution is to make basic_string's debug check support the v3
extension that s[s.size()] returns char() for non-const s.

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

> >Should I use the DR ChangeLog format like this?
> >  
> >
> Seems ok, like mine ;)

Yeah, copy'n'pasted from your  :)

jon



More information about the Libstdc++ mailing list