Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> I propose a macro castNode() that combines the assertion and the cast,
> so this would become
> RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc));
Seems like an OK idea, but I'm concerned by the implied multiple
evaluations, particularly if you're going to apply this to function
results --- as the above example does. I think you need to go the
extra mile to make it single-evaluation. See newNode() for ideas.
Just to bikeshed a bit ... would "castNode" be a better name?
Seems like a closer analogy to makeNode(), for instance.
regards, tom lane