Re: [PATCH v9 9/9] cocci: allow padding with `strbuf_addf()`
- From
Teng Long <dyroneteng@gmail.com>
- Date
- Jan 10, 2022, 14:40 UTC
- Message-ID
- <CADMgQSQWZRG2tCQ6tfBXMdyaVEzmWi0-5qCM3N1+YeN5nVMoGw@mail.gmail.com>
- In-Reply-To
- <nycvar.QRO.7.76.6.2201101346090.339@tvgsbejvaqbjf.bet>
Show 7 quoted lines
> I strongly disagree. Using a format requires the reader to interpret a > `printf()` format, to remember (if they ever knew) the rules about padding > with `%<number>s` formats, and then to satisfy themselves that the result > is correct. > > That's quite the cognitive load you put on the reader for something as > trivial as " -".
> Not a fan, > Johannes
Ok. I will modify the next patch according to your opinion, I just hope to understand the problems and make better contributions in the future.
Thanks.
On Mon, Jan 10, 2022 at 8:49 PM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 21 quoted lines
> > Hi Teng, > > On Mon, 10 Jan 2022, Teng Long wrote: > > > [...] about the using "strbuf_addf(line, "%7s" , "-");" or > > "strbuf_addstr(line, " -");". [...] > > > > Why I prefer more of the former that is because, for the single line, > > it's more readable I think. > > I strongly disagree. Using a format requires the reader to interpret a > `printf()` format, to remember (if they ever knew) the rules about padding > with `%<number>s` formats, and then to satisfy themselves that the result > is correct. > > That's quite the cognitive load you put on the reader for something as > trivial as " -". > > Not a fan, > Johannes