stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: test for
Date Thu, 22 Jun 2006 01:59:42 GMT
Anton Pevtsov wrote:
> Here is another one possible issue:
> As I understand, paragraph 4 the os.setstate() should be called
> after os.width(0). In stdcxx width(0) is called after the setstate() and
> if the exceptions mask is not ios_base::goodbit then width(0) will not
> called. The Dinkumware STL and STLPort calls width (0) before
> setstate().

I agree, although I note that GNU libstdc++ behaves the same as
stdcxx. I believe both implementations are incorrect.

FWIW, the standard is slightly inconsistent when it comes to these
things. I've sent an email to the committee's reflector proposing
to clean them up (see the attachment). I also put together a test
program exercising all formatted output functions (including the
string overload which isn't listed as one but should be) according
to the current requirements as well as according to the requirements
I propose. See

> incubator\stdcxx\trunk\include\ostream
> //, p3 - defined here, declared inline in <string>
> template<class _CharT, class _Traits, class _Allocator> inline
> basic_ostream<_CharT, _Traits>&
> operator<< (basic_ostream<_CharT, _Traits>                  & __strm,
>            const basic_string<_CharT, _Traits, _Allocator> &__str) {
>    _RW::__rw_insert (__strm, (), __str.length (),
>                      __strm.width ()).width (0);
>    return __strm;
> }
> See the attached test, please.
> What do you think about this?

Let's create an issue and fix it. The change shouldn't be too
difficult. I'll leave it up to you to propose a patch :)


View raw message