You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2006/03/07 17:48:25 UTC

%{#*S} inserts NULs (was: Re: test for 21.strings.capacity)

Anton Pevtsov wrote:
[...]
>> <>>Yes. That's the expected result. In general, the extended 
>> formatting>directives (such as %{#*S}) format their arguments so that 
>> they are human readable even when the arguments contain non-printable 
>> characters.
> 
> 
> Here I meant the following. Suppose my
> basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >
> contains the string "abc". And when I printed it
> out in the --trace mode using the %{#*S} directive I have got "a\0b", but
> "abc" (or "a\0b\0c\0" if each byte is printed) was expected.
> Is this correct?

No, that would not be correct. If there are no NULs in the string
the directive certainly shouldn't print any. Can you put together
a small test case? (The little program I copied in my previous
response behaved correctly.)

Martin