From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Avoid suspects casts VARHDRSZ (c.h) |
Date: | 2020-09-26 21:49:52 |
Message-ID: | 66075.1601156992@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:
> In all the static analysis tools I’ve used, there are literally *hundreds*
> of alerts about a one suspect cast:
> 64 bits sizet_t -> 32 bits int -> 64 bits size_t
> -#define VARHDRSZ ((int32) sizeof(int32))
> +#define VARHDRSZ (sizeof(int32))
Given that the compiler can very easily see that there is no actual
overflow there, I question whether these warnings are of any value.
Also, the proposed patch changes the type of that macro from signed
to unsigned, meaning that it's considerably riskier than you seem
to think. We'd have to look at every usage to see if that would
affect the interpretation of any comparisons, for example.
On the whole I see little value here.
Suggest finding a tool with less nanny-ish tendencies.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Pryzby | 2020-09-27 02:59:17 | Re: More efficient RI checks - take 2 |
Previous Message | Tom Lane | 2020-09-26 21:03:27 | Re: Get rid of runtime handling of AlternativeSubPlan? |