Re: [HACKERS] safer node casting
| От | Tom Lane |
|---|---|
| Тема | Re: [HACKERS] safer node casting |
| Дата | |
| Msg-id | 2981.1483207240@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | [HACKERS] safer node casting (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>) |
| Ответы |
Re: [HACKERS] safer node casting
Re: [HACKERS] safer node casting |
| Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: