Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goEZU-0000L6-PQ for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Jan 2019 21:36:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1goEZT-0001nz-KN for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Jan 2019 21:35:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goEZT-0001lG-Bg for pgsql-hackers@lists.postgresql.org; Mon, 28 Jan 2019 21:35:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goEZQ-00075z-KG for pgsql-hackers@lists.postgresql.org; Mon, 28 Jan 2019 21:35:58 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x0SLZnGY015667; Mon, 28 Jan 2019 16:35:49 -0500 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org Subject: Re: Proposed refactoring of planner header files In-reply-to: <20190128210211.4is52ckj2voz2bdl@alap3.anarazel.de> References: <11460.1548706639@sss.pgh.pa.us> <20190128203229.yreabsq6kinxdnh5@alap3.anarazel.de> <13179.1548708622@sss.pgh.pa.us> <20190128210211.4is52ckj2voz2bdl@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 28 Jan 2019 13:02:11 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15665.1548711349.1@sss.pgh.pa.us> Date: Mon, 28 Jan 2019 16:35:49 -0500 Message-ID: <15666.1548711349@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2019-01-28 15:50:22 -0500, Tom Lane wrote: >> Andres Freund 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