This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 1/3] Add strfromd, strfromf, and strfroml functions
- From: Joseph Myers <joseph at codesourcery dot com>
- To: "Gabriel F. T. Gomes" <gftg at linux dot vnet dot ibm dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Fri, 16 Sep 2016 23:22:54 +0000
- Subject: Re: [PATCH v2 1/3] Add strfromd, strfromf, and strfroml functions
- Authentication-results: sourceware.org; auth=none
- References: <1472569664-12402-1-git-send-email-gftg@linux.vnet.ibm.com> <1472569664-12402-2-git-send-email-gftg@linux.vnet.ibm.com>
On Tue, 30 Aug 2016, Gabriel F. T. Gomes wrote:
> +/* Convert a floating-point number to a string. */
> +#if __GLIBC_USE (IEC_60559_BFP_EXT)
> +extern int strfromd (char *dest, size_t size, const char *format, double f)
> + __THROW __nonnull ((3));
> +
> +extern int strfromf (char *dest, size_t size, const char *format, float f)
> + __THROW __nonnull ((3));
> +
> +extern int strfroml (char *dest, size_t size, const char *format,
> + long double f)
> + __THROW __nonnull ((3));
> +#endif
You need a leading __ on the parameter names in headers; what you have
here violates namespace rules.
> + /* Parse the precision. */
> + if (ISDIGIT (*format))
> + {
> + precision = 0;
> + while (ISDIGIT (*format))
> + {
> + precision *= 10;
> + precision += TODIGIT (*format);
> + format++;
I'd still expect you to use read_int from printf-parse.h (which avoids
undefined behavior on overflow).
--
Joseph S. Myers
joseph@codesourcery.com