Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

In theory, there is no difference between theory and practice. In practice, there is.


devel / comp.lang.c / Re: simple positional printf code review

SubjectAuthor
o Re: simple positional printf code reviewKaz Kylheku

1
Re: simple positional printf code review

<20210427085417.210@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16007&group=comp.lang.c#16007

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 563-365-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: simple positional printf code review
Date: Tue, 27 Apr 2021 15:58:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <20210427085417.210@kylheku.com>
References: <6e8017a1-ca34-4e99-b541-b2ba87b9cc66n@googlegroups.com>
<s678d7$8uf$1@dont-email.me> <s6790c$8uf$2@dont-email.me>
<f024614a-ed9b-48d9-86e1-041a649f185fn@googlegroups.com>
<68oe8g5vs7o684u7t71t2jp4ctjqohvrha@4ax.com>
Injection-Date: Tue, 27 Apr 2021 15:58:11 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2a50cb469edb08d831f61743dbb536a5";
logging-data="23909"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VqSM4P51BaxtOWofHBARza1O519SK4vk="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:mc+vddLrZ7PT9Bzk7I6Msg4DbAM=
 by: Kaz Kylheku - Tue, 27 Apr 2021 15:58 UTC

On 2021-04-27, Geoff <geoff@invalid.invalid> wrote:
> On Mon, 26 Apr 2021 14:00:07 -0700 (PDT), Thiago Adams
><thiago.adams@gmail.com> wrote:
>
>>On Monday, April 26, 2021 at 5:49:23 PM UTC-3, Lew Pitcher wrote:
>>> damn keyboard, switched the questionmark and dollarsign on me :-S
>>[..]
>>> > printf("%2$*1$d", width, num);
>>
>>This worked at Windows..but snprintf apparently is not implemented on windows.
>>
>>_printf_p("A %1$s B %2$s C %1$s", "ONE", "TWO");
>>
>
> snprintf is implemented on Windows.

Windows has an undocumented library called MSVCRT.DLL that applications
are not supposed to use. If you reverse-engineer that from some versions
of Windows, you might might find a C99 snprintf.

> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=msvc-160
>
> Per the document:
> Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf

Visual Studio 2015 is a tool which suports C development that is not a
part of Windows. It provides a redistributable run-time.

According to this sense of "on windows", Windows has had a working
snprintf before VS 2015, because of Cygwin: another tool that supports C
development on Windows, also with its own libraries.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor