Skip site navigation (1) Skip section navigation (2)

Re: libpq object hooks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
Cc: "Andrew Chernow" <ac(at)esilo(dot)com>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: libpq object hooks
Date: 2008-05-16 15:24:10
Message-ID: 17534.1210951450@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
"Merlin Moncure" <mmoncure(at)gmail(dot)com> writes:
> Switch, plus struct (basically a union) will do the trick nicely.  Can
> it be a formal union, or is it better as a void*?

I don't think a union buys much notational convenience or safety here,
although admittedly it's a close question.  In one case you're trusting
to cast the pointer to the appropriate type, in the other you're
trusting to use the right union member.  One advantage of separate
structs is that there's no reason not to make the struct type names
long enough to be clear, whereas there's a very strong notational
temptation to make union member names short, because you'll be typing
them a lot.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Merlin MoncureDate: 2008-05-16 15:26:13
Subject: Re: libpq object hooks
Previous:From: Peter EisentrautDate: 2008-05-16 15:21:42
Subject: Re: ecpg localization

pgsql-patches by date

Next:From: Merlin MoncureDate: 2008-05-16 15:26:13
Subject: Re: libpq object hooks
Previous:From: Andrew DunstanDate: 2008-05-16 15:21:15
Subject: Re: libpq object hooks

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group