incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: test for lib.string.io
Date Wed, 28 Jun 2006 01:09:08 GMT
Anton Pevtsov wrote:
> Martin, the changes look goog, but I have a question about __rw_insert:
> 
> When macro _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE is defined the width(0)
> will be called only if __pad > 0. But pad can be <= 0 when len >= width.

I see what you mean. This must pass:

   #include <cassert>
   #include <sstream>

   int main ()
   {
       std::ostringstream strm;
       strm.width (-1);
       strm << ' ';
       assert (0 == strm.width ());
   }

> 
> I propose to add '.' after "if (len < width)" to the comment:

Sounds good.

> 
[...]
> Also it may be useful to remove lines:
[...]
> and append these lines:
[...]
> What do you think about this?

Good catch, thanks! The changes you suggest are in the attached
patch.

Btw., it was pointed out to me that the width test was still subtly
wrong WRT the currently mandated behavior for single character
inserters: they are specified to reset width before inserting any
characters. I fixed this bug in the test but I haven't yet fixed it
in the library. Since the single char inserters are implemented using
the same function as the array forms and since the array forms are
supposed to call width(0) after they're done inserting the fix would
require either adding a new overload of __rw_insert for the single-char
inserters or adding an argument to the array overload of __rw_insert()
as you suggested yesterday. I haven't decided which we should go with
or even if it's worth the trouble. I'm beginning to think that we might
just go with the proposed behavior and forget about strict conformance
here since the latter is inconsistent and would be a hassle to
implement.

Martin

Mime
View raw message