bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glibc's snprintf can fail with ENOMEM: replacement needed


From: Eric Blake
Subject: Re: glibc's snprintf can fail with ENOMEM: replacement needed
Date: Fri, 11 Apr 2008 06:04:10 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 4/11/2008 4:43 AM:
|   1) for float to decimal conversion, think of snprintf (NULL, "%Le", x)
|      or snprintf (NULL, "%Lf", x)
|
| At least in the first case, I don't see how the number of output bytes could
| be determined without doing the actual conversion.

True, but in the first case, the maximum number of significant digits is
known in advance, so you can still use a fixed-size stack-allocated buffer
to do the work.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf/U7oACgkQ84KuGfSFAYCL4gCg19NInXfh4k6iXzQhoWOTbeRH
KkYAnAsnr7PAz0tXPB+9Bze1TZGBOFvb
=xMm0
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]