From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: refactoring - share str2*int64 functions |
Date: | 2019-08-29 00:22:37 |
Message-ID: | 20190829002237.GC1864@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-08-29 00:46:39 | Re: Improve error detections in TAP tests by spreading safe_psql |
Previous Message | Michael Paquier | 2019-08-29 00:09:05 | Re: REINDEX filtering in the backend |