Re: Why does load_external_function() return PGFunction? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Why does load_external_function() return PGFunction?
Date
Msg-id 21121.1526223950@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why does load_external_function() return PGFunction?  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, May 10, 2018 at 4:45 PM, Andres Freund <andres@anarazel.de> wrote:
>> IMO the important
>> part isn't that the parameters fit exactly - we'll have to cast for the
>> return type anyway - but that it's declared as a pointer-to-function for
>> the hyptothetical supported platform that has different pointers to
>> functions than to other objects.

> Probably the more relevant concern is what's going to compile
> warning-free on all supported compilers.

+1

> I think it's unlikely that
> such a hypothetical supported platform actually exists, although maybe
> I'm wrong.

Such platforms certainly used to exist, and not that long ago either.
I think the last common example was that Intel compilers used to let
you choose the size of data pointers separately from the size of code
pointers, cf
https://en.wikipedia.org/wiki/Intel_Memory_Model

There's some other entertaining reading here:
https://en.wikipedia.org/wiki/Harvard_architecture

Those sorts of pushups have fallen into disfavor with the availability
of larger address spaces, and these days it's a bit hard to imagine
anybody porting PG to a new platform that works like that.  But that's
why the C standard discourages considering code and data pointers as
being interchangeable.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Why does load_external_function() return PGFunction?
Next
From: Simon Muller
Date:
Subject: Allow COPY's 'text' format to output a header