On Sat, Mar 18, 2023 at 3:08 PM Tom Lane <
tgl@sss.pgh.pa.us> wrote:
> Joseph Koshakow <
koshy44@gmail.com> writes:
>> On Thu, Mar 9, 2023 at 12:42 PM Ashutosh Bapat <
ashutosh.bapat.oss@gmail.com>
>> wrote:
>>> There are a lot of these diffs. PG code doesn't leave an extra space
>>> between variable name and *.
>
>> Those appeared from running pg_indent. I've removed them all.
>
> More specifically, those are from running pg_indent with an obsolete
> typedefs list. Good practice is to fetch an up-to-date list from
> the buildfarm:
>
> curl
https://buildfarm.postgresql.org/cgi-bin/typedefs.pl -o .../typedefs.list
>
> and use that. (If your patch adds any typedefs, you can then add them
> to that list.) There's been talk of trying harder to keep
> src/tools/pgindent/typedefs.list up to date, but not much has happened
> yet.
I must be doing something wrong because even after doing that I get the
same strange formatting. Specifically from the root directory I ran
curl
https://buildfarm.postgresql.org/cgi-bin/typedefs.pl -o src/tools/pgindent/typedefs.list
src/tools/pgindent/pgindent src/backend/utils/adt/datetime.c src/include/common/int.h src/backend/utils/adt/timestamp.c src/backend/utils/adt/date.c src/backend/utils/adt/formatting.c src/backend/utils/adt/selfuncs.c src/include/datatype/timestamp.h src/include/utils/timestamp.h
> The specific issue with float zero is that plus zero and minus zero
> are distinct concepts with distinct bit patterns, but the IEEE spec
> says that they compare as equal. The C standard says about "if":
>
> [#1] The controlling expression of an if statement shall
> have scalar type.
> [#2] In both forms, the first substatement is executed if
> the expression compares unequal to 0. In the else form, the
> second substatement is executed if the expression compares
> equal to 0.
>
> so it sure looks to me like a float control expression is valid and
> minus zero should be treated as "false". Nonetheless, personally
> I'd consider this to be poor style and would write "r != 0" or
> "r != 0.0" rather than depending on that.
Thanks for the info, I've updated the three instances of the check to
be "r != 0.0"
> BTW, this may already need a rebase over 75bd846b6.
The patches in this email should be rebased over master.
- Joe Koshakow