From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in23.apple.com (mail-out23.apple.com [17.171.2.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 154AB21AEB0B3 for ; Fri, 11 Aug 2017 14:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1502485546; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tfHpVK6FCzF6T9AdBBVaXr7E7jUkVuO4V8vnwsCVr9g=; b=b56P0+zlNn9CSytoWzbzyyMUyl8pm27iXNwOp6EIYHxiwNTZG5jBP/CRIdQke7JF WsO736gqP4ppMtb7J850ZgMmI3sWNpm6BNyVPgShA5gECCX1yjSjfEEHHwuvUTNK +6qG8WBrzDxfyQSyXM5bw2nbOvY4xWYGC1FQKw7s59kIdQ+AdYDm7Wq8reliZNUn nd39AItIhz+OiESMr0ooBi4pEB4ZotGjOscPMD6JamXc4kGs/eJW6NcliIK0ieVa VbL1IP2G1e6DNl4F8HvgGl387Zqtf4pOBIsF8gWxjboL9w/engtlGDCSBav37e+o zgGEgw001E91ohZOwN0Ttg==; Received: from relay27.apple.com (relay27.apple.com [17.171.128.108]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in23.apple.com (Apple Secure Mail Relay) with SMTP id B1.8E.08001.A2C1E895; Fri, 11 Aug 2017 14:05:46 -0700 (PDT) X-AuditID: 11ab0217-c21ff70000001f41-4d-598e1c2a6d7e Received: from ma1-mmpp-sz08.apple.com (ma1-mmpp-sz08.apple.com [17.171.128.176]) by relay27.apple.com (Apple SCV relay) with SMTP id F5.E8.03167.92C1E895; Fri, 11 Aug 2017 14:05:45 -0700 (PDT) MIME-version: 1.0 Received: from [17.234.211.28] by ma1-mmpp-sz08.apple.com (Oracle Communications Messaging Server 8.0.1.2.20170621 64bit (built Jun 21 2017)) with ESMTPSA id <0OUJ003ZCH9I5U40@ma1-mmpp-sz08.apple.com>; Fri, 11 Aug 2017 14:05:45 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish Message-id: <91624C25-675E-43E8-A6F4-A48232CAA03F@apple.com> Date: Fri, 11 Aug 2017 14:05:41 -0700 In-reply-to: <150248431260.29687.8219608274582743547@jljusten-skl> Cc: Laszlo Ersek , edk2-devel-01 , Mike Kinney , Leif Lindholm , Ard Biesheuvel To: Jordan Justen References: <20170811164851.9466-1-lersek@redhat.com> <20170811164851.9466-3-lersek@redhat.com> <150248431260.29687.8219608274582743547@jljusten-skl> X-Mailer: Apple Mail (2.3273) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCLMWRmVeSWpSXmKPExsUiuLohR1dLpi/S4PgaNov/H3YzWuw5dJTZ Yse1fhaLT7v3sFgsO7aDxaKj4x+TA5vH4j0vmTzuXNvD5tE9+x+Lx/t9V9kCWKK4bFJSczLL Uov07RK4MlacectU8OYXY8WVdSwNjFduMnYxcnBICJhItBzS7WLk4hASWM8k8frJFNYuRk6w +M4Pl1khEocZJU509rCBJHgFBCV+TL7HAmIzC4RJ3Fi0hQmi6CujxL4Vm8GKhAXEJd6d2cQM YrMJKEusmP+BHWQbr4CNxN7Z8SD1wgL9jBKLpu1jAomzCKhKfJvpBFLOKeAk8WvbVnaQGmaB y4wSE/7dBZsjIqAr0bf8DwvEsplAFzV9gzpVVuLW7EvMIAkJgetsEn+a7zBOYBSaheTaWUiu hbC1JL4/agWKcwDZ8hIHz8tChDUlnt37xA5ha0s8eXeBdQEj2ypG4dzEzBzdzDwjY73EgoKc VL3k/NxNjOBoYhL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04osRRnJBpqMRcVJwIAbVyP zXsCAAA= X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: [edk2-CCodingStandardsSpecification PATCH 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed arguments X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 21:03:26 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT > On Aug 11, 2017, at 1:45 PM, Jordan Justen wrote: > > On 2017-08-11 09:48:51, Laszlo Ersek wrote: >> The "one argument per line" style as the sole possibility takes up too >> much vertical space, wastes perfectly good horizontal space, and causes a >> constant jump-to-the-left eye movement for the reader. >> >> Now that we have limited the line length to 80 colums, the "condensed >> arguments" style cannot be abused; permit it. >> >> Cc: Ard Biesheuvel >> Cc: Jordan Justen >> Cc: Leif Lindholm >> Cc: Michael D Kinney >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Laszlo Ersek >> --- >> 5_source_files/52_spacing.md | 29 +++++++++++++++++++- >> README.md | 1 + >> 2 files changed, 29 insertions(+), 1 deletion(-) >> >> diff --git a/5_source_files/52_spacing.md b/5_source_files/52_spacing.md >> index ddeabf7753a8..fc8a5e7e58e7 100644 >> --- a/5_source_files/52_spacing.md >> +++ b/5_source_files/52_spacing.md >> @@ -133,7 +133,9 @@ If ((--MyInteger) > 0) { >> #### 5.2.2.4 Subsequent lines of multi-line function calls should line up two spaces from the beginning of the function name >> >> If a function call or function like macro invocation is broken up into multiple >> -lines, then: >> +lines, then follow one of the alternatives below. >> + >> +##### 5.2.2.4.1 The "one argument per line" style >> >> * One argument per line, including the first argument on its own line. >> * Indent each argument 2 spaces from the start of the function name. If a >> @@ -165,6 +167,31 @@ DEBUG (( >> )); >> ``` >> >> +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 using as much width as allowed, but then again I've got 3440 X 1440 monitors I'm using all the time. Another place that multiple things on the same line make sense is InstallMultipleProtocolInterfaces. I think that makes the code more readable. Status - gBS->InstallMultipleProtocolInterfaces ( NULL, &gEdk2Protocol1Guid, &gEdk2Protocol1Data, &gEdk2Protocol2WithLongNameGuid, &gEdk2Protocol2WithLongNameData, NULL ); Given a lot of this stuff is arbitrary (I had fun on the 1st coding standard doc) I think staying with what a lot of the code already does is not a bad idea. Thanks, Andrew Fish > 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 think you might want to break out the multiple params per line and > closing parens change out to allow for separate discussion. > > -Jordan > >> + >> +DEBUG ((DEBUG_INFO, "The addresses of the 4 buffers are %p, %p, %p, and %p\n", >> + Buffer1, Buffer2, Buffer3, Buffer4)); >> +``` >> + >> +This line breaking style prevents overly frequent saccades to the left, without >> +resulting in overlong lines. >> + >> #### 5.2.2.5 Always put space after commas or semicolons that separate items >> >> This punctuation is not necessary if no code or comments follow the comma or >> diff --git a/README.md b/README.md >> index 8fad5a327b8c..437024e57677 100644 >> --- a/README.md >> +++ b/README.md >> @@ -113,3 +113,4 @@ Copyright (c) 2006-2017, Intel Corporation. All rights reserved. >> | 2.2 | Convert to Gitbook | June 2017 | >> | | [#425](https://bugzilla.tianocore.org/show_bug.cgi?id=425) [CCS] clarify line breaking and indentation requirements for multi-line function calls | | >> | | Limit lines to 80 columns | | >> +| | Introduce the "condensed arguments" line breaking style | | >> -- >> 2.13.1.3.g8be5a757fa67 >> >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel