Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 8D0A22E0057 for ; Fri, 16 May 2008 12:24:17 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 98017-03 for ; Fri, 16 May 2008 12:24:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id 6C7E42E006A for ; Fri, 16 May 2008 12:24:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m4GFOA2K017535; Fri, 16 May 2008 11:24:10 -0400 (EDT) To: "Merlin Moncure" cc: "Andrew Chernow" , "Andrew Dunstan" , "Alvaro Herrera" , "Patches (PostgreSQL)" Subject: Re: libpq object hooks In-reply-to: References: <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> <17177.1210949948@sss.pgh.pa.us> Comments: In-reply-to "Merlin Moncure" message dated "Fri, 16 May 2008 11:13:43 -0400" Date: Fri, 16 May 2008 11:24:10 -0400 Message-ID: <17534.1210951450@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/327 X-Sequence-Number: 6353 "Merlin Moncure" 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