On Wed, Aug 28, 2019 at 09:50:44AM +0200, Fabien COELHO wrote:
> - *ptr && WHATEVER(*ptr)
> *ptr is redundant, WHATEVER yields false on '\0', and it costs on each
> char but at the end. It might be debatable in some places, e.g. it is
> likely that there are no spaces in the string, but likely that there are
> more than one digit.
Still this makes the checks less robust?
> If you want all/some *ptr added back, no problem.
>
> - isdigit repeated on if and following while, used if/do-while instead.
I see, you don't check twice if the first character is a digit this
way.
> Hmmm. Have you looked at the fallback cases when the corresponding builtins
> are not available?
>
> I'm unsure of a reliable way to detect a generic unsigned int overflow
> without expensive dividing back and having to care about zero…
Mr Freund has mentioned that here:
https://www.postgresql.org/message-id/20190717184820.iqz7schxdbucmdmu@alap3.anarazel.de
> So I was pretty happy with my two discreet, small and efficient tests.
That's also a matter of code and interface consistency IMHO.
--
Michael