From: | Peter Geoghegan <peter(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Daniel Farina <daniel(at)heroku(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Re: pg_stat_statements normalisation without invasive changes to the parser (was: Next steps on pg_stat_statements normalisation) |
Date: | 2012-03-28 09:47:49 |
Message-ID: | CAEYLb_UrXQ7fOMrAZxEfJYN-Eq0Km+HhViWvmbCPg8mn_wn1bw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
[ also for the archives' sake ]
On 27 March 2012 22:05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Well, testing function pointers for null is certainly OK --- note that
> all our hook function call sites do that. It's true that testing for
> equality to a particular function's name can fail on some platforms
> because of jump table hacks.
I was actually talking about stylistic iffiness. This seems contrary
to the standard, which states:
(ISO C 99 section 6.5.9.6)
"Two pointers compare equal if and only if both are null pointers,
both are pointers to the same object (...) or function,
both are pointers to one past the last element of the same array object,
or one is a pointer to one past the end of one array object and the
other is a pointer to the start of a different array object that happens
to immediately follow the first array object in the address space."
However, the fly in the ointment is IA-64 (Itanic), which apparently
at least at one stage had broken function pointer comparisons, at
least when code was built using some version(s) of GCC.
I found it a bit difficult to square your contention that performing
function pointer comparisons against function addresses was what
sounded like undefined behaviour, and yet neither GCC nor Clang
complained. However, in light of what I've learned about IA-64, I can
certainly see why we as a project would avoid the practice.
Source: http://gcc.gnu.org/ml/gcc/2003-06/msg01283.html
--
Peter Geoghegan http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2012-03-28 09:49:59 | Re: poll: CHECK TRIGGER? |
Previous Message | Dimitri Fontaine | 2012-03-28 08:12:43 | Re: Command Triggers patch v18 |