On Tue, Jul 12, 2016 at 01:17:20PM +0100, Eric Engestrom wrote:
> On Mon, Jul 11, 2016 at 05:55:15PM -0700, Bryce Harrington wrote:
> > strtoul() has a side effect that when given a string representing a
> > negative number, it returns a negated version as the value, and does not
> > flag an
On Tue, Jul 12, 2016 at 10:58:05AM -0700, Bill Spitzak wrote:
> I tested this and at least for libc on linux it returns 0x1-n, ie
> "-1" is 0x.
>
> This is actually pretty useful when the unsigned value is bitflags or you
> want to guarantee you typed in the largest number
On Mon, Jul 11, 2016 at 05:55:15PM -0700, Bryce Harrington wrote:
> strtoul() has a side effect that when given a string representing a
> negative number, it returns a negated version as the value, and does not
> flag an error. IOW, strtoul("-42", ) sets val to 42. This could
> potentially
strtoul() has a side effect that when given a string representing a
negative number, it returns a negated version as the value, and does not
flag an error. IOW, strtoul("-42", ) sets val to 42. This could
potentially result in unintended surprise behaviors, such as if one were
to inadvertantly