[cfe-dev] clang-format and PenaltyReturnTypeOnItsOwnLine?

David Blaikie dblaikie at gmail.com
Sat Aug 17 01:33:17 PDT 2013


On Aug 16, 2013 9:31 PM, "Leif Hedstrom" <zwoop at apache.org> wrote:
>
> Hi all,
>
> Hope this is the right channel for this question :). I'm looking at
possibly using clang-format to clean up an indentation / formatting style
mess for a fairly large project (Apache Traffic Server). One of our
"quirks" is that we currently format our functions like:
>
> inline const char*
> some_func(int some_arg)
> {
>> }
>
>
> I've tried both
>
>         PenaltyReturnTypeOnItsOwnLine: 0
>
> and
>
>         PenaltyReturnTypeOnItsOwnLine: 10000
>
>
> and various numbers in between, but it always formats the above like
>
> inline const char* some_func(int some_arg)
> {
>> }
>
>
> Maybe I'm misunderstanding what PenaltyReturnTypeOnItsOwnLine does?

I assume it identifies the 'cost of splitting a line after the return.
Relative costs of different splits are used in comparisons to decide on the
optimal split - I doubt it'll change anything related to the behavior of
the unsplit lines.

> What's even more confusing is that if I use the "mozilla" predefined
format, it still doesn't format it like I expect. And I'm 99% certain that
Mozilla code also uses the "return type on its own line" formatting.
>
> Cheers!
>
> -- leif
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130817/cd35a47e/attachment.html>


More information about the cfe-dev mailing list