| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Mikhail Gribkov <youzhick(at)gmail(dot)com> |
| Cc: | Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Bitwise OR instead of logical one in test_aio.c |
| Date: | 2026-11-25 23:27:31 |
| Message-ID: | 65C0E256-E662-470A-9084-16A6E98AD55A@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Nov 26, 2026, at 05:02, Mikhail Gribkov <youzhick(at)gmail(dot)com> wrote:
>
> Hi hackers,
>
> I've noticed an odd check in test_aio.c:
> if (zero_on_error | zero_damaged_pages)
> srb_flags |= READ_BUFFERS_ZERO_ON_ERROR;
>
> Both zero_on_error and zero_damaged_pages declared as bool. Shouldn't there be a logical "||" inside the if-condition, not a bitwise "|"?
> Yes, it works now, but fixing it would be cleaner.
For two boolean variables “a" and “b", "a | b" and "a || b" will produce the same result, so there is no correctness issue. But I agree fixing that improves readability.
>
> Proposed patch is attached (although it's quite trivial).
>
> --
> best regards,
> Mikhail A. Gribkov
>
> <001_Fix_bitwise_operation_on_bools.patch>
LGTM.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zsolt Parragi | 2026-11-25 23:31:57 | Re: Adding a stored generated column without long-lived locks |
| Previous Message | Lukas Fittl | 2026-11-25 23:21:31 | Re: Unify parallel worker handling for index builds and instrumentation |