Re: Proposed refactoring of planner header files - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Proposed refactoring of planner header files
Date
Msg-id 15666.1548711349@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposed refactoring of planner header files  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2019-01-28 15:50:22 -0500, Tom Lane wrote:
>> Andres Freund <andres@anarazel.de> writes:
>>> Ugh, isn't it nicer to just use the underlying struct type instead of
>>> that?

>> No, because that'd mean that anyplace relying on optimizer.h would also
>> have to write "struct PlannerInfo" rather than "PlannerInfo"; the
>> effects wouldn't be limited to the header itself.

> Why? It can be called with the typedef'd version, or not.

Because I don't want users of the header to have to declare, say, local
variables as "struct PlannerInfo *root" instead of "PlannerInfo *root".
The former is not project style and I will not accept forcing that in
order to save a couple of #ifdefs in headers.  I don't actually understand
what you find so ugly about it.

One idea that would save a lot of random "struct foo" hacks in headers
is to allow nodes.h to include "typedef struct MyNode MyNode" for any
recognized node type.  We could either do that just for nodes we've
found it useful for, or pre-emptively for the whole list.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Why are we PageInit'ing buffers in RelationAddExtraBlocks()?
Next
From: Tom Lane
Date:
Subject: Re: Proposed refactoring of planner header files