Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzLxw-0008Kd-Bq for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Dec 2021 16:56:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mzLxt-0003cg-V7 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Dec 2021 16:56:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzLxt-0003cX-KI for pgsql-hackers@lists.postgresql.org; Mon, 20 Dec 2021 16:56:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzLxr-0004Nx-A3 for pgsql-hackers@lists.postgresql.org; Mon, 20 Dec 2021 16:56:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1BKGueko2448557; Mon, 20 Dec 2021 11:56:41 -0500 From: Tom Lane To: Peter Eisentraut cc: Peter Smith , PostgreSQL Hackers Subject: Re: PublicationActions - use bit flags. In-reply-to: <3b7f2bdd-77ed-00d7-437c-dd9c37e6a2fa@enterprisedb.com> References: <3b7f2bdd-77ed-00d7-437c-dd9c37e6a2fa@enterprisedb.com> Comments: In-reply-to Peter Eisentraut message dated "Mon, 20 Dec 2021 14:58:06 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2448555.1640019400.1@sss.pgh.pa.us> Date: Mon, 20 Dec 2021 11:56:40 -0500 Message-ID: <2448556.1640019400@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > On 20.12.21 01:18, Peter Smith wrote: >> I felt it is more natural to implement boolean flag combinations using >> a bitmask instead of a struct of bools. IMO using the bitmask also >> simplifies assignment and checking of said flags. > I don't see why this is better. It just makes the code longer and adds > more punctuation and reduces type safety. It makes the code shorter in places where you need to process all the flags at once, but I agree it's not really an improvement elsewhere. Not sure if it's worth changing. One thing I noted is that the duplicate PublicationActions typedefs will certainly draw warnings, if not hard errors, from some compilers. You could get around that by removing the typedefs altogether and just using "int", which'd be more consistent with our usual practices anyway. But it does play into Peter's objection about type safety. regards, tom lane