From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Making C function declaration parameter names consistent with corresponding definition names
Date: Fri, 16 Sep 2022 21:20:56 -0400
Message-ID: <3955318.1663377656@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH2-Wzk2etJjj8rhKn9MG9hQ2B+5tWuZneCkGyusqraGQaaeBA@mail.gmail.com>
References: <CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com>
<3913123.1663370391@sss.pgh.pa.us>
<CAH2-WzmxBXZAE6eyAm1XyPp6X7epCwih5qBupTxQOc6Hqp48fQ@mail.gmail.com>
<3922750.1663372191@sss.pgh.pa.us>
<CAH2-Wzk2etJjj8rhKn9MG9hQ2B+5tWuZneCkGyusqraGQaaeBA@mail.gmail.com>
Peter Geoghegan <pg@bowt.ie> writes:
> The check that I used to write the patches doesn't treat unnamed
> parameters in a function declaration as an inconsistency, even when
> "strict" is used. Another nearby check *could* be used to catch
> unnamed parameters [1] if that was deemed useful, though. How do you
> feel about unnamed parameters?
I think they're easily Stroustrup's worst idea ever. You're basically
throwing away an opportunity for documentation, and that documentation
is often sorely needed. Handy example:
extern void ReorderBufferCommitChild(ReorderBuffer *, TransactionId, TransactionId,
XLogRecPtr commit_lsn, XLogRecPtr end_lsn);
Which TransactionId parameter is which? You might be tempted to guess,
if you think you remember how the function works, and that is a recipe
for bugs.
I'd view the current state of reorderbuffer.h as pretty unacceptable on
stylistic grounds no matter which position you take. Having successive
declarations randomly using named or unnamed parameters is seriously
ugly and distracting, at least to my eye. We don't need such blatant
reminders of how many cooks have stirred this broth.
regards, tom lane
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, pg@bowt.ie, pgsql-hackers@lists.postgresql.org
Subject: Re: Making C function declaration parameter names consistent with corresponding definition names
In-Reply-To: <3955318.1663377656@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