Re: Avoid undefined behavior with msvc compiler (src/include/port/pg_bitutils.h) - Mailing list pgsql-hackers

From John Naylor
Subject Re: Avoid undefined behavior with msvc compiler (src/include/port/pg_bitutils.h)
Date
Msg-id CAFBsxsG+cqJigDg01+Yr68KkpdVnDWq0Ow1q7hzvpFJ+5wkSHg@mail.gmail.com
Whole thread Raw
In response to Re: Avoid undefined behavior with msvc compiler (src/include/port/pg_bitutils.h)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Avoid undefined behavior with msvc compiler (src/include/port/pg_bitutils.h)
List pgsql-hackers

On Sun, Jul 30, 2023 at 9:45 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> John Naylor <john.naylor@enterprisedb.com> writes:
> > It seems that we should have "Assert(word != 0);" at the top, which matches
> > the other platforms anyway, so I'll add that.
>
> That's basically equivalent to the existing Assert(non_zero).
> I think it'd be okay to drop that one and instead have
> the same Assert condition as other platforms, but having both
> would be redundant.

Works for me, so done that way for both forward and reverse variants. Since the return value is no longer checked in any builds, I thought about removing the variable containing it, but it seems best to leave it behind for clarity since these are not our functions.

--
John Naylor
EDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Masahiro Ikeda
Date:
Subject: Re: Support to define custom wait events for extensions
Next
From: Bharath Rupireddy
Date:
Subject: Re: Support to define custom wait events for extensions