Re: cast result of copyNode()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Dilger <hornschnorter(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: cast result of copyNode()
Date: 2017-03-07 23:34:15
Message-ID: 10066.1488929655@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mark Dilger <hornschnorter(at)gmail(dot)com> writes:
> You appear to be using a #define macro to wrap a function of the same name
> with the code:

> #define copyObject(obj) ((typeof(obj)) copyObject(obj))

> I don't necessarily have a problem with that, but it struck me as a bit odd, and
> grep'ing through the sources, I don't see anywhere else in the project where that
> is done for a function of the same number of arguments, and only one other
> place where it is done at all:

I agree that that seems like a bad idea. Better to rename the underlying
function --- for one thing, that provides an "out" if some caller doesn't
want this behavior.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-03-07 23:41:05 Re: Write Ahead Logging for Hash Indexes
Previous Message Josh Berkus 2017-03-07 23:31:27 Re: Proposal for changes to recovery.conf API