| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: for loop variable fixes |
| Date: | 2026-06-23 16:09:02 |
| Message-ID: | e58b5038-c503-4821-8cd7-ea56e8484fa3@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 23.06.26 16:12, Tom Lane wrote:
> +1 for improving this --- I was annoyed about it just yesterday
> with respect to resowner.c. It looks to me like just about every
> single instance of "for (int ..." in that file is wrong because
> what's being compared to is unsigned. I see that your patch gets
> a couple of those places, but only a couple, which makes me wonder
> what -Wsign-compare is checking exactly.
I see several instances like
for (int idx = 0; idx < owner->narr; idx++)
where narr is of type uint8. Since uint8 is of lower rank than int, it
gets converted to int for the comparison operator, and then there is no
more type mismatch. So that would appear to be why the warning doesn't
trigger for these.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Xuneng Zhou | 2026-06-23 16:12:01 | Re: 048_vacuum_horizon_floor.pl hangs due to wakeup lost inside LockBufferForCleanup |
| Previous Message | Rui Zhao | 2026-06-23 16:07:23 | Re: [PATCH] Preserve replication origin OIDs in pg_upgrade |