pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Andrew Chernow <ac@esilo.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Patches (PostgreSQL) <pgsql-patches@postgresql.org>
Subject: Re: libpq object hooks
Date: Fri, 16 May 2008 11:24:10 -0400
Message-ID: <17534.1210951450@sss.pgh.pa.us> (raw)
In-Reply-To: <b42b73150805160813x7fba1ccaif0c7d28cc2d53f4d@mail.gmail.com>
References: <b42b73150804301323i18b00019i62e765708abb65aa@mail.gmail.com>
	<b42b73150805150852m7b3c28fai2d7a4497c84118b2@mail.gmail.com>
	<6044.1210867771@sss.pgh.pa.us>
	<482C77E5.1060500@esilo.com>
	<9458.1210875556@sss.pgh.pa.us>
	<482C82BA.3090100@esilo.com>
	<9867.1210877054@sss.pgh.pa.us>
	<482CD76E.6000202@esilo.com>
	<b42b73150805160628y3c175608hc383187951206448@mail.gmail.com>
	<17177.1210949948@sss.pgh.pa.us>
	<b42b73150805160813x7fba1ccaif0c7d28cc2d53f4d@mail.gmail.com>

"Merlin Moncure" <mmoncure@gmail.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



view thread (45+ messages)  latest in thread

Message-ID: <17534.1210951450@sss.pgh.pa.us>
Permalink:  ../17534.1210951450@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17534.1210951450@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-patches@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mmoncure@gmail.com, ac@esilo.com, andrew@dunslane.net, alvherre@commandprompt.com
  Subject: Re: libpq object hooks
  In-Reply-To: <17534.1210951450@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox