[PATCH v2 1/3] Add strfromd, strfromf, and strfroml functions
Joseph Myers
joseph@codesourcery.com
Fri Sep 16 23:23:00 GMT 2016
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
More information about the Libc-alpha
mailing list