public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Noel Grandin <noelgrandin@gmail.com>
To: cygwin@cygwin.com
Subject: Re: possible snprintf() regression in 3.3.2
Date: Thu, 18 Nov 2021 16:11:06 +0200	[thread overview]
Message-ID: <fa647f83-c5ed-6dea-fcba-c8b799abe12f@gmail.com> (raw)
In-Reply-To: <YZZSzPhbqF6cQAiu@calimero.vinschen.de>



On 2021/11/18 3:19 pm, Corinna Vinschen via Cygwin wrote:
> My patch raised NDEC from 43 to 1023 to allow aproximately the same
> number of digits as glibc.  Newlib strives to support embedded targets
> and bare metal.  Some of them are lucky if they have a stack size of 1K.
> The outbuf buffer is created on the stack, so I used ndigits to save
> stack space.
> 
> While that patch fixes the reported problem, it will make users of
> smaller-than-Cygwin targets pretty unhappy.
> 
> A workaround would be to malloc outbuf instead.  Given that printf

printf is often performance sensitive, and using malloc there would likely be significantly slower.

Possibly use alloca() to allocate only the necessary amount on stack?
Seems unlikely that embedded systems would be printing values that needed such large space anyway.

  reply	other threads:[~2021-11-18 14:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  0:37 Tony Cook
2021-11-17  9:21 ` Takashi Yano
2021-11-17 12:27   ` Corinna Vinschen
2021-11-18  0:06     ` Tony Cook
2021-11-18 11:35       ` Takashi Yano
2021-11-18 13:19         ` Corinna Vinschen
2021-11-18 14:11           ` Noel Grandin [this message]
2021-11-18 14:27             ` Corinna Vinschen
2021-11-18 21:08               ` Sam Edge
2021-11-21  0:16                 ` Tony Cook
2021-11-22 10:34                   ` Corinna Vinschen
2021-11-22 13:04                     ` Corinna Vinschen
2021-11-22 23:23                       ` Tony Cook
2021-11-23  8:34                         ` Takashi Yano
2021-11-23  9:48                           ` Corinna Vinschen
2021-11-24  3:40                             ` Takashi Yano
2021-11-24  8:48                               ` Corinna Vinschen
2021-11-24  8:52                               ` Takashi Yano
2021-11-24  9:14                                 ` Takashi Yano
2021-11-24  9:28                                   ` Corinna Vinschen
2021-11-24 12:29                                     ` Lemke, Michael  SF/HZA-ZI2E
2021-11-25 12:02                                     ` Takashi Yano
2021-11-25 12:45                                       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa647f83-c5ed-6dea-fcba-c8b799abe12f@gmail.com \
    --to=noelgrandin@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).