Re: Signed vs Unsigned (take 2) (src/backend/storage/ipc/procarray.c) - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Signed vs Unsigned (take 2) (src/backend/storage/ipc/procarray.c)
Date
Msg-id 20210612192716.nb75rglpn2owjwoq@alap3.anarazel.de
Whole thread Raw
In response to Signed vs Unsigned (take 2) (src/backend/storage/ipc/procarray.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: Signed vs Unsigned (take 2) (src/backend/storage/ipc/procarray.c)
List pgsql-hackers
Hi,

On 2021-06-12 10:55:22 -0300, Ranier Vilela wrote:
> With the recent changes at procarray.c, I take a look in.
> msvc compiler, has some warnings about signed vs unsigned.

> 1. Size_t is weird, because all types are int.

Not sure why I ended up using size_t here. There are cases where using a
natively sized integer can lead to better code being generated, so I'd
want to see some evaluation of the code generation effects.


> 2. Wouldn't it be better to initialize static variables?

No, explicit initialization needs additional space in the binary, and
static variables are always zero initialized.


> 3. There are some shadowing parameters.

Hm, yea, that's not great. Those are from

commit 0e141c0fbb211bdd23783afa731e3eef95c9ad7a
Author: Robert Haas <rhaas@postgresql.org>
Date:   2015-08-06 11:52:51 -0400

    Reduce ProcArrayLock contention by removing backends in batches.

Amit, Robert, I assume you don't mind changing this?


> 4. Possible loop beyond numProcs?

What are you referring to here?

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: recovery test failures on hoverfly
Next
From: "Finnerty, Jim"
Date:
Subject: Re: Character expansion with ICU collations