Re: Operands don't affect result (CONSTANT_EXPRESSION_RESULT) (src/backend/utils/adt/jsonfuncs.c)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Operands don't affect result (CONSTANT_EXPRESSION_RESULT) (src/backend/utils/adt/jsonfuncs.c)
Date: 2021-02-11 04:46:08
Message-ID: 1340553.1613018768@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> writes:
> *long* 4 *long int*, *signed long int* -2.147.483.648 a 2.147.483.647
> Therefore long never be > INT_MAX at Windows 64 bits.
> Thus lindex is always false in this expression:
> if (errno != 0 || badp == c || *badp != '\0' || lindex > INT_MAX || lindex
> < INT_MIN)

Warnings about this are purest nanny-ism.

At the same time, I think this code could be improved; but the way
to do that is to use strtoint(), rather than kluging the choice of
datatype even further.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2021-02-11 06:33:36 Re: Parallel INSERT (INTO ... SELECT ...)
Previous Message Tom Lane 2021-02-11 04:39:43 Some regular-expression performance hacking