Hi Bruno, On Thu, Mar 20, 2025 at 01:44:49PM +0100, Bruno Haible 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'. Yeah. The only issue with that is not having the full range of uintmax_t. But I still think it's a misfeature. Have a lovely day! Alex -- <https://www.alejandro-colomar.es/>
Attachment:
signature.asc
Description: PGP signature