Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 69488 invoked from network); 7 Mar 2006 16:56:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Mar 2006 16:56:33 -0000 Received: (qmail 67296 invoked by uid 500); 7 Mar 2006 16:56:33 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 67247 invoked by uid 500); 7 Mar 2006 16:56:33 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 67236 invoked by uid 99); 7 Mar 2006 16:56:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Mar 2006 08:56:33 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of AntonP@moscow.vdiweb.com designates 195.210.189.132 as permitted sender) Received: from [195.210.189.132] (HELO mail.moscow.vdiweb.com) (195.210.189.132) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Mar 2006 08:56:32 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: %{#*S} inserts NULs (was: Re: test for 21.strings.capacity) Date: Tue, 7 Mar 2006 19:56:10 +0300 Message-ID: <4D6A8407B7AC6F4D95B0E55C4E7C4C6203CC4336@exmsk.moscow.vdiweb.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: %{#*S} inserts NULs (was: Re: test for 21.strings.capacity) Thread-Index: AcZCBmLbPlv6UdDIRimExm09ifaXYgAAVkCw From: "Anton Pevtsov" To: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Yes, here it is: #include #include int main (int argc, char** argv) { wchar_t* tmp =3D L"abc"; std::basic_string, std::allocator > 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? Thanks, Anton Pevtsov. -----Original Message----- From: Martin Sebor [mailto:sebor@roguewave.com]=20 Sent: Tuesday, March 07, 2006 19:48 To: stdcxx-dev@incubator.apache.org Subject: %{#*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. >=20 >=20 > Here I meant the following. Suppose my > basic_string, allocator >=20 > contains the string "abc". And when I printed it out in the --trace=20 > mode using the %{#*S} directive I have got "a\0b", but "abc" (or=20 > "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