<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 13, 2015 at 9:10 AM, Michael Park <span dir="ltr"><<a href="mailto:mcypark@gmail.com" target="_blank" class="cremed">mcypark@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Tim,<div><br></div><div>I've spoken to @djasper about this style and have just started to work on adding a new option to support it.</div><div><br></div><div>The closest I was able to get was to set:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><b>AlignAfterOpenBracket: false </b></blockquote><div><br></div><div>which produces:</div><div><br></div><div>(1) Fit everything in 1 line.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">void someReallyLongFunction(int firstParameter, int secondParameter)<br>{<br>  someReallyLongObject.someReallyLongFunction(firstParameter, secondParameter);<br>}<br></blockquote><div><br></div><div>(2) Fit everything in next line</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">void someReallyLongFunction(<br>    int firstParameter, int secondParameter, int thirdParameter)<br>{<br>  someReallyLongObject.someReallyLongFunction(<br>      firstParameter, secondParameter, thirdParameter);<br>}<br></blockquote><div><br></div><div>(3) Everything on its own line</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">void someReallyLongFunction(int firstParameter,<br>    int secondParameter,<br>    int thirdParameter,<br>    int fourthParameter,<br>    int fifthParameter)<br>{<br>  someReallyLongObject.someReallyLongFunction(firstParameter,<br>      secondParameter,<br>      thirdParameter,<br>      fourthParameter,<br>      fifthParameter);<br>}</blockquote><div><br></div><div>Currently, I live with this configuration and wrap the first parameter/argument manually. (Not ideal, but still beats formatting all of it manually!)</div><div><br></div><div><b>NOTE</b>: If you're looking to skip (2), you can also set <b>AllowAllParametersOfDeclarationOnNextLine: false</b>. A caveat here is that this only applies for parameters and <b>not</b> for arguments. @djasper: Since we have <b>BinPackParameters</b> and <b>BinPackArguments</b> separated now, perhaps we could also introduce <b>AllowAllArgumentsOnNextLine</b> option to control this?</div></div></blockquote><div><br></div><div>I'd think that we should rather get rid of AllowAllParametersOfDeclarationOnNextLine and instead turn BinPackParameters/BinPackArguments into an enum.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>MPark.</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On 12 May 2015 at 07:28, Tim W <span dir="ltr"><<a href="mailto:timpie.w@gmail.com" target="_blank" class="cremed">timpie.w@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>I really like a refactoring and version system friendly code style :)</div><div>What I means is that we don't want to align parameter/arguments based on the name of the function.  So when the parameter/arguments don't fit on one line we want each of them on their own line but we first want have a break before the first parameter.</div><div><br></div><div>    //example</div><div><br></div><div>    void fooWithAVeryLongParamList(<br>        int firstParameter,</div><div>        int secondParameter</div><div>        int lastParameter)</div><div>    {</div><div>        object.alsoThisDoenstFitSoIBreakImmidiatly(</div><div>            firstParameter,</div><div><div>            secondParameter,</div></div><div><div>            lastParameter);</div></div><div>    }</div><div><br></div><div><br></div><div>I tried already a lot of option and played with the Penalties but had no luck. </div><div><br></div><div>Any idea if this is possible with the current set of options?<br></div></div></div></div></blockquote></div></div></blockquote><div><br></div><div>It is not and I'd be very hesitant to support it based on your reasoning. Refactoring and version system friendliness are concerns when writing code. clang-format's explicit goal is to make code readable. Code in general is read way more often than it is written and thus optimizing for writeability isn't a good idea in general.</div><div><br></div><div>Generally, the bar for options to make it into clang-format are that either they are trivial which this isn't or they are used in large (ideally open-source) projects and have a publicly available style guide where the precise rules are written down. This is a trade-off, but in general, we'd much rather have clang-format support a subset of thinkable styles really well instead of having it support every little style nuance that somebody might like. Now, if there are large projects and accessible style guides, this trade-off changes somewhat as the value clang-format might give to people working on such projects outweigh the additional cost.</div><div><br></div><div>I think clang-format already has too many style options (as we have been too lenient when apply the bar mentioned above) and would much rather kill some of them instead of introducing even more.</div><div><br></div><div>Cheers,</div><div>Daniel</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div></div><div><br></div><div>Kind regards,</div><div>Tim</div><div><br></div><div><br></div>--<br clear="all"><div><div>An Apple a day keeps Windows away<br><br>ACCU - <a href="http://www.accu.org" target="_blank" class="cremed">http://www.accu.org</a> - Professionalism in Programming.</div></div>
</div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank" class="cremed">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div>