Avoid suspects casts VARHDRSZ (c.h)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Avoid suspects casts VARHDRSZ (c.h)
Date: 2020-09-26 14:20:32
Message-ID: CAEudQArKoEwofiQJJA2AEv--YZixqX60xJB0=Cn0x8O8Uz4oRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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))

Is there any special reason for not simplifying this and avoiding these
alerts?
Passed 100% with vcregress check and in use in local tests.

regards,
Ranier Vilela

Attachment Content-Type Size
avoid_suspects_cast_VARHDRSZ.patch application/octet-stream 396 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2020-09-26 15:56:35 Re: Get rid of runtime handling of AlternativeSubPlan?
Previous Message Amit Kapila 2020-09-26 10:58:44 Re: Logical replication CPU-bound with TRUNCATE/DROP/CREATE many tables