On 2013-12-05 10:34:16 -0500, Tom Lane wrote:
> Andres Freund <and...@2ndquadrant.com> writes:
> > I was actually thinking about making Datum (and some other types we
> > have) structs or unions. Currently it's far, far to easy to mix them. We 
> > throw
> > away pretty much all of the little typesafety C has by typedef'ing them
> > to integral types with lots of autocasting behaviour.
> 
> That's intentional; on many ABIs, making Datum a struct would be
> catastrophic performance-wise because it would not be eligible for simple
> register pass or return conventions.

Unions should behave saner in that regard tho? And it be fairly easy to
make it an optional thing.

> In any case, the number of bugs I can remember that such a thing
> would've prevented is negligible.

Cases talked about upthread, where a plain datatype is returned as a
Datum instead of using FooGetDatum() and the reverse, would be
impossible. I don't think those are that infrequent?

Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to