This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 1/3] Add strfromd, strfromf, and strfroml functions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]