From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Geoghegan <peter(at)2ndquadrant(dot)com> |
Cc: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Further news on Clang - spurious warnings |
Date: | 2011-08-04 06:08:00 |
Message-ID: | 1323.1312438080@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Peter Geoghegan <peter(at)2ndquadrant(dot)com> writes:
> On 3 August 2011 21:03, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I mean that it's unclear what you'll get if status has a bitpattern
>> equivalent to a negative integer. If the compiler implements the
>> comparison as signed, the test will yield TRUE; if unsigned, it's FALSE.
> On compilers on which the enum value is represented as an unsigned
> int, passing -1 is just the same as doing that with any function with
> an unsigned int argument for that argument - it will convert to a
> large unsigned value . So sure, that isolated part of the test's
> outcome will vary depending on whether or not the compiler opts to
> represent the enum as signed when it can, but I don't look at it as
> you do. I simply consider that to be a violation of the enum's
> contract, or the caller's failure to consider that the enum couldn't
> represent -1 -- they got what they asked for.
This argument is completely missing the point of the test, which is to
verify whether or not the caller adhered to the enum's contract. You
can *not* assume that he did while arguing about whether the test is
valid or accomplishes its goals.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2011-08-04 06:11:57 | Re: Transient plans versus the SPI API |
Previous Message | Heikki Linnakangas | 2011-08-04 05:59:07 | Re: Further news on Clang - spurious warnings |