tech-misc archive

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

Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD



Alejandro Colomar wrote:
> > At the same time, disallowing a leading '-' sign
> > is a benefit as well. I consider it a misfeature that strtoul() parses
> > "-3" successfully and returns ULONG_MAX-2, which was most certainly
> > not intended by the user.
> 
> Agree; it is a misfeature.  ...
> 
> I wonder if there's any legitimate user of that misfeature.

I don't think there is. Callers who wish to accept a leading '-' sign
can call strtol() and cast the result to 'unsigned long'.

Bruno





Home | Main Index | Thread Index | Old Index