delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/06/11/09:25:51

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SARE_SUB_PCT_LETTER
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4FD5EB79.6060707@sister-shadow.de>
References: <CAKw7uVgEzeqw9=hRSiLtN-YkgWFhTPg-_VoTOowPUt0TXE2fyQ AT mail DOT gmail DOT com> <4FD5EB79 DOT 6060707 AT sister-shadow DOT de>
Date: Mon, 11 Jun 2012 15:25:21 +0200
Message-ID: <CAKw7uViZd4X0az0Sqob4LDFBX6PfF4cU3DXmBwUG11-VncmGHg@mail.gmail.com>
Subject: Re: s?wprintf family of functions has broken %s formatter output
From: =?UTF-8?Q?V=C3=A1clav_Zeman?= <vhaisman AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q5BDPmRB002505

On 11 June 2012 14:58, Otto Meta <otto DOT meta AT sister-shadow DOT de> wrote:
>> `-->  ./testvswprintf.exe
>
>> this works, 1, 2, 3...
>> but the following does not:
>> ret: 1
>> buf: >T<
>>> T<
>> ret: 4
>> wcout: >THIS IS A TEST<
>>
>> The same code works well on both Ubuntu with GCC and on Windows with
>> Visual Studio 2010.
>
>
> I just tried your test with g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2:
>
> $> ./testvswprintf
> this works, 1, 2, 3...
> but the following does not:
> ret: 1
> buf: >T<
>>T<
> ret: 4
> wcout: >THIS IS A TEST<
>
> Looks quite the same, so it’s not really a Cygwin-only problem.
> My Ubuntu 11.04 is a bit dated already, so maybe you have a newer
> Ubuntu version with a fixed swprintf?
I have done some more checking and I might have been wrong about the
Ubuntu and Linux in general. It looks like the formatting strings are
incompatible between MSVC and *NIX. It appears that either %S (SUSv2)
or %ls (C99) is needed on *NIX. MSVC switches the meaning of %s for
wprintf() (http://linux.die.net/man/3/printf).

*big SIGH*

-- 
VZ

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019