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 21:52:32 UTC

Re: %{#*S} inserts NULs

I still can't reproduce the behavior. I tried both x86 (gcc 3.2.3)
and x86_64 (gcc 3.4.4) but the test case behaves as expected. What
I said I saw below must have been some kind of a fluke...

What exactly is your architecture/OS/compiler/build type?

Martin

Martin Sebor wrote:
> Anton Pevtsov wrote:
> 
>> Yes, here it is:
>>
>> #include <string>
>> #include <rw_printf.h>
>>
>> int main (int argc, char** argv)
>> {
>>     wchar_t* tmp = L"abc";
>>     std::basic_string<wchar_t, std::char_traits<wchar_t>,
>> std::allocator<wchar_t> > s (tmp, 3);
>>     rw_printf ("%{#*S}\n", sizeof (wchar_t), &s);
>>
>>     return 0;
>> }
>>
>> I got "a\0b". Maybe, I use the %{#*S} in wrong way?
> 
> 
> No (except for passing size_t instead of int to it), but I still
> can't reproduce the behavior you describe. I get L"abc" just as
> you expect.
> 
> Hang on a second, though. I'm testing this on Solaris/SPARC. On
> Linux/x86_64 I get L"a\0\0" so there clearly is a problem with
> the directive. Let me look into it.
> 
> Martin