Re: cast result of copyNode()

From: Mark Dilger <hornschnorter(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: cast result of copyNode()
Date: 2017-03-07 23:27:12
Message-ID: 20170307232712.10866.40453.pgcf@coridan.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: not tested
Spec compliant: not tested
Documentation: not tested

Hi Peter,

I like the patch so far, and it passes all the regression tests for me on both mac and linux. I
am very much in favor of having more compiler type checking, so +1 from me.

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:

$ find src/ -type f -name "*.h" -or -name "*.c" | xargs cat | perl -e 'while(<>) { print if (/^#define (\w+)\b.*\b\1\s*\(\b/); }'
#define copyObject(obj) ((typeof(obj)) copyObject(obj))
#define mkdir(a,b) mkdir(a)

I'm just flagging that for discussion if anybody thinks it is too magical.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-03-07 23:31:26 Re: Bizarre choice of case for RELKIND_PARTITIONED_TABLE
Previous Message Neha Khatri 2017-03-07 23:22:56 Re: [NOVICE] opr_charset rule in gram.y