Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQZrG-00BlXH-1K for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 23:32:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQZrF-00AUWa-1F for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 23:32:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQZrF-00AUWS-0J for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 23:32:33 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQZrD-002ot7-0d for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 23:32:33 +0000 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-343514c7854so219616a91.1 for ; Tue, 02 Dec 2025 15:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764718349; x=1765323149; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mt01lMCrkqXZc04ogTGOsCKTHjwmgZPU9nii0dy/mls=; b=Ay58QW7lVHAdyQ46wJZ1CyuQkK72nDZcg64OEuYngzgi5KQzsW9YA0joxT3JiM+Yjf 9fdtZzmeO0iFtupOvZ6EPi6bret/i1+I3jcNRJSHhq0XEdMEWiZEOukJzZmYI81DjdbL BOz5CxLkv0bYqylZwsh31CgPJKJNttbuPgQ4FgH96oE9UKpEWmMFhhs6W/owc/sJdwt3 aLmRAGb9kGF19VHjL0N5/Pgn78S41SmXzf/FtSyYx9Lb1VNcsPRLzPPXoElEIGYnEWvB MTLRhO4zvMDhSvu3SIYOPTppTmWQjkOxeIbHp2uY0e0J7aCbi1UOhXx2RU9n+8mQIdFT dLqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764718349; x=1765323149; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mt01lMCrkqXZc04ogTGOsCKTHjwmgZPU9nii0dy/mls=; b=lRtV/MJUp9BVOryrvci0VhOVTS4vFFldDXJRm3GyUE4ZlT5GwhTMYHqdPKm5sC+MtI aj46yZIZnPxf+xTImLhACxFGVfIbLxI4GAlF3zpOnXPPzKXFSK2nRHX3wreRhVO91Nnl LGN9KAD5IA8z6TXdfHLKO1EdmUqahTRHYsd2LDJppqt19ItjhoFMLp7nxA1Xci7Bz2ZE lWZ4+j5VaBYujWT4NWQB3nkzTYustpgBQE1kyhWsQuGptPDwphBVbt3CVBdI8+6ba2D2 M5OSie4rK4ne8dMHWOLKj6XLAaJbzPbvJwvZt1jBxvIv8E9z1jrwIzKFGVk1dLHgMolF u/zg== X-Forwarded-Encrypted: i=1; AJvYcCWZkbFkoSpc7eMrCpE6JJ8GY5l2exKfYgwXN0Tj92l3ECDcR85p27R062d3PVQ8JefkLpvGTBvsVHJ8+CCJ@lists.postgresql.org X-Gm-Message-State: AOJu0YzBhPqUQNX95xhxbKljMloMscCcYK/l+YtVTOMyqOKJaxsQkzg6 Vw1oh3iht9xyltRfxM6AWp6qeH+ZpS5XmQL1/hUpHRVf4Xu9jYmRLeNq X-Gm-Gg: ASbGncs/71GXwTFDshPxhghCu4iCta+urM/lT90YmYwKbqOgknxUf7y++cIIP/KrHaJ ZaCNvFmEDf8HvQR2fVdJKzGW4okjlduY3GouyDO/57MGSfRs1prJiKHEd7o+O3/I/A3Vs3wE9ZC 6uoWHI1f28gOGCrzW5cpohx6qxBbbXQbkqyCz9vCoj6fRiqJya4uP+N4fLtsGqet9JqKMihMIun RaISl4lnI+hLcBw81/5lCgMYU2OTUuHLzslaq/BkG7rfWhZiBWQgCzCXbK9rzxC9DIwmzCCD1bT yUIAtY3QX0wujcsCIQbw4ZollEFCQjH1pGkqk3kULXLtcnfDwRNDmBXoWSFpoGUoW5AqxQD55Y5 0zYinQ3AFOMa4bMrA2JLg+5CaK58TKi97ZVRJEczRJInfFVS93gXSKpgIE97zhDtAL3Fd0e1JCH HPWj6SO8GMjiYyDsE5Ow0= X-Google-Smtp-Source: AGHT+IG33f5sGB0qA2BehPe+r677+HipvIxCp7NtH4HV4cWYAjBQFt7mbPjUPDKTmmBO1GKtL+067Q== X-Received: by 2002:a17:90b:1c8d:b0:340:dd63:3fd5 with SMTP id 98e67ed59e1d1-349080260acmr4517856a91.17.1764718348642; Tue, 02 Dec 2025 15:32:28 -0800 (PST) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34910a80656sm574698a91.0.2025.12.02.15.32.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Dec 2025 15:32:28 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: pgindent versus struct members and typedefs From: Chao Li In-Reply-To: <512380.1764717196@sss.pgh.pa.us> Date: Wed, 3 Dec 2025 07:31:48 +0800 Cc: Nathan Bossart , Rahila Syed , Robert Haas , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <347EA055-D626-414C-B10D-7E70041B9B55@gmail.com> <509793.1764715875@sss.pgh.pa.us> <5E70CB69-1E2D-471B-8CF8-83205E5E14CE@gmail.com> <512380.1764717196@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 3, 2025, at 07:13, Tom Lane wrote: >=20 > Chao Li writes: >>> On Dec 3, 2025, at 06:51, Tom Lane wrote: >>> In this case, I think pgindent is indirectly enforcing good style. >>> I do not like omitting braces around anything that's more than one >>> line; readers have to pay close attention to whether the code is >>> doing what it was intended to. >=20 >> For =E2=80=9Cone line=E2=80=9D, do you mean only a single line of = statement or one line statement plus one line comment? >=20 > In my head, a comment and a statement are two lines, and so need > wrapping braces as much as two statements would do. I realize that > C compilers think differently, but for readability and modifiability > reasons that's the approach I take. >=20 Totally agreed. In my first job at Lucent Technologies, the coding = standard was that braces should always be added even if a clause has = only one line of code. I remember one of the explanations was like, if = braces has been added, then later when a new line of code is added to = the clause, there is only one line of diff, otherwise braces need to be = added, so it would be 3 lines of diffs. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/