bug-gnulib
[Top][All Lists]
Advanced

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

Re: maintainer-makefile troubles and suggestions


From: Ben Pfaff
Subject: Re: maintainer-makefile troubles and suggestions
Date: Thu, 21 Jan 2010 10:57:33 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Martin von Gagern <address@hidden> writes:

> sc_prohibit_atoi_atof:
> ----------------------
>
> The comment claims that [fs]?scanf doesn't provide error feedback. The
> "return value" section of my scanf(3) man page says differently: the
> number of successful conversions is returned, which is quite a suitable
> error indication in many cases, I believe.

The feedback that scanf lacks is whether the individual values
converted are in the correct range for the types to which they
are assigned.  The C standard says scanf yields undefined
behavior if the user provides an out-of-range value:

     7.19.6.2 The fscanf function

     ...the result of the conversion is placed in the object
     pointed to by the first argument following the format
     argument that has not already received a conversion
     result. If this object does not have an appropriate type, or
     if the result of the conversion cannot be represented in the
     object, the behavior is undefined.

This is definitely irritating.
-- 
Ben Pfaff 
http://benpfaff.org





reply via email to

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