Re: [PATCH 00/14] numparse module: systematically tighten up integer parsing
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 25, 2015, 21:59 UTC
- Message-ID
- <xmqqegoc20y8.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <5513252A.7050601@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
[jc: dropped a non-working address from Cc list]
Show 9 quoted lines
> I wasn't aware of strtonum; thanks for the reference. It has an > untraditional interface. Their willingness to sacrifice half of the > unsigned range and requirement that the user specify minval and maxval > have the nice effect of permitting one function to be used for all > integer types. > ... > I think git will need more flexibility, for example to support other > radixes and to allow trailing characters. So personally I don't think we > should use (or imitate) strtonum().
I had the same impression. An earlier suggestion by Peff about uintmax_t may be something we might want to keep in mind; we might want to use strtoll/strtoull as the underlying implementation if we wanted to avoid rolling our own.
Thanks.