Joseph Koshakow <kosh...@gmail.com> writes: > On Thu, Mar 9, 2023 at 12:42 PM Ashutosh Bapat <ashutosh.bapat....@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've separated this out into another patch attached to this email. > Should I start a new email thread or is it ok to include it in this > one? Having separate threads with interdependent patches is generally a bad idea :-( ... the cfbot certainly won't cope. >> I see that this code is very similar to the corresponding code in >> timestamp and >> timestamptz, so it's bound to be correct. But I always thought float >> equality >> is unreliable. if (r) is equivalent to if (r == 0.0) so it will not >> work as >> intended. But may be (float) 0.0 is a special value for which equality >> holds >> true. > I'm not familiar with float equality being unreliable, but I'm by no > means a C or float expert. Can you link me to some docs/explanation? 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. BTW, this may already need a rebase over 75bd846b6. regards, tom lane