public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Leif Lindholm <leif.lindholm@linaro.org>,
	Jordan Justen <jordan.l.justen@intel.com>
Cc: edk2-devel-01 <edk2-devel@lists.01.org>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [edk2-CCodingStandardsSpecification PATCH 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed arguments
Date: Tue, 15 Aug 2017 13:16:04 +0200	[thread overview]
Message-ID: <922996c2-e60a-80ec-6d4a-8b2e5a639c9b@redhat.com> (raw)
In-Reply-To: <20170812101346.6tw7rcs2c7trit2p@bivouac.eciton.net>

On 08/12/17 12:13, Leif Lindholm wrote:
> On Fri, Aug 11, 2017 at 01:45:12PM -0700, Jordan Justen wrote:
>>> +Use this line breaking style especially if it saves a format string or complex
>>> +argument from being split, or when commenting on individual arguments.
>>> +
>>> +##### 5.2.2.4.2 The "condensed arguments" style
>>> +
>>> +For most function calls and function-like macro invocations, the "one argument
>>> +per line" style uses up valuable vertical space without utilizing readily
>>> +available horizontal space. Such statements are permitted to condense the
>>> +arguments and the closing parenthesis (or parentheses), up to the allowed line
>>> +length. The indentation requirements are identical to those of the "one
>>> +argument per line" style.
>>> +
>>> +```c
>>> +CopyMem (Destination, Source, SIZE_4KB);
>>> +
>>> +Status = gBS->AllocatePool (EfiBootServicesData, sizeof (DRIVER_NAME_INSTANCE),
>>> +                &PrivateData);
>>
>> I prefer that we just have one style, and just drop the requirement
>> that multiline param lists can only have one arg per line. I think it
>> is good to have the first param start on the next line in this case.
>>
>>   Status = gBS->AllocatePool (
>>                   EfiBootServicesData, sizeof (DRIVER_NAME_INSTANCE),
>>                   &PrivateData);
> 
> I like this one better than Laszlo's proposal, since it keeps the
> start of each line of parameters in the same column.
> 
>> This compacts things somewhat, but still keeps the parameter list
>> aligned horizontally on subsequent lines.
>>
>> Regarding the closing parens being on a separate line, I think we
>> should also remove that as a requirement.
> 
> I would also support that change.
> 
>> I think you might want to break out the multiple params per line and
>> closing parens change out to allow for separate discussion.
> 
> That would make sense.
> 
> Laszlo - many thanks to starting this discussion!

Thanks all for the feedback. Before I attempt to post version 2, I'd
like to see the "preference" wording sorted out (raised by Mike and
Jordan). I.e., whether the new style should be merely tolerated (but
still frowned upon) or if it should be a first class citizen.

(Stating the obvious,) if the new style were accepted into the CCS,
personally I would switch to it for all new code written by me (even if
the code were for MdePkg or MdeModulePkg), independently of the
preference assigned to the new style.

I would not require OvmfPkg / ArmVirtPkg contributors to follow my
preference -- NB I've been enforcing the one style we now have in the
CCS, for the packages I co-maintain, in spite of my dislike for that
style -- but I might suggest the alternative style to others if I
perceived the vertical space consumption very disturbing.

Thanks!
Laszlo


  reply	other threads:[~2017-08-15 11:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11 16:48 [edk2-CCodingStandardsSpecification PATCH 0/2] improvements related to line wrapping Laszlo Ersek
2017-08-11 16:48 ` [edk2-CCodingStandardsSpecification PATCH 1/2] Source Files / General Rules: limit line lengths to 80 columns Laszlo Ersek
2017-08-11 20:52   ` Jordan Justen
2017-08-11 21:01     ` Kinney, Michael D
2017-08-11 22:52   ` Ard Biesheuvel
2017-08-12  2:39     ` Jordan Justen
2017-08-12 10:03     ` Leif Lindholm
2017-08-15 10:57     ` Laszlo Ersek
2022-11-13  1:25       ` [edk2-devel] " Chang, Abner
2022-11-13  1:59         ` Michael D Kinney
2022-11-13  8:47           ` Chang, Abner
2017-08-11 16:48 ` [edk2-CCodingStandardsSpecification PATCH 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed arguments Laszlo Ersek
2017-08-11 20:45   ` Jordan Justen
2017-08-11 21:04     ` Kinney, Michael D
2017-08-12  1:31       ` Jordan Justen
2017-08-11 21:05     ` Andrew Fish
2017-08-12 10:13     ` Leif Lindholm
2017-08-15 11:16       ` Laszlo Ersek [this message]
2022-11-13  1:35         ` [edk2-devel] " Chang, Abner
2022-11-13  1:57           ` Michael D Kinney
2022-11-13  8:44             ` Chang, Abner
2022-11-13 17:36               ` Michael D Kinney
2022-11-14  1:09                 ` Chang, Abner
2022-11-14 17:07                   ` Michael D Kinney
2022-11-14 17:37                     ` Michael Kubacki
     [not found]                     ` <17278424C4A5D78F.32003@groups.io>
2022-11-14 18:05                       ` Michael Kubacki
2022-11-14 18:25                         ` Michael D Kinney
2022-11-14 18:49                           ` Michael Kubacki
2022-11-14 18:59                             ` Michael D Kinney
2022-11-14 19:08                             ` Sean
2022-11-15  2:38                               ` Chang, Abner
2017-08-11 17:07 ` [edk2-CCodingStandardsSpecification PATCH 0/2] improvements related to line wrapping Kinney, Michael D
2017-08-15 11:01   ` Laszlo Ersek
2017-08-15 15:17     ` Kinney, Michael D
2017-08-15 16:17       ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=922996c2-e60a-80ec-6d4a-8b2e5a639c9b@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox