pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: vignesh C <vignesh21@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Unused header file inclusion
Date: Wed, 31 Jul 2019 16:55:31 -0400
Message-ID: <22389.1564606531@sss.pgh.pa.us> (raw)
In-Reply-To: <20190731203607.GA5260@alvherre.pgsql>
References: <20190731203607.GA5260@alvherre.pgsql>

Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2019-Jul-31, Andres Freund wrote:
>> * I think a lot of the interlinking stems from the bad idea to use
>> typedef's everywhere. In contrast to structs they cannot be forward
>> declared portably in our version of C. We should use a lot more struct
>> forward declarations, and just not use the typedef.

> I don't know about that ... I think the problem is that we both declare
> the typedef *and* define the struct in the same place.  If we were to
> split those things to separate files, the required rebuilds would be
> much less, I think, because changing a struct would no longer require
> recompiles of files that merely pass those structs around (that's very
> common for Node-derived structs).  Forward-declaring structs in
> unrelated header files just because they need them, feels a bit like
> cheating to me.

Yeah.  I seem to recall a proposal that nodes.h should contain

	typedef struct Foo Foo;

for every node type Foo, and then the other headers would just
fill in the structs, and we could get rid of a lot of ad-hoc
forward struct declarations and other hackery.

			regards, tom lane





view thread (30+ messages)  latest in thread

Message-ID: <22389.1564606531@sss.pgh.pa.us>
Permalink:  ../22389.1564606531@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22389.1564606531@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, andres@anarazel.de, vignesh21@gmail.com
  Subject: Re: Unused header file inclusion
  In-Reply-To: <22389.1564606531@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox