← Back to team overview

kicad-developers team mailing list archive

Re: Formatting: break after templates

 

I don't have a preference on this so I'm fine with the proposal.  We
have very few templates in the KiCad source so it's impact is low.

On 3/26/2019 8:28 AM, John Beard wrote:
> Oops, missing newline in the "after" case: should be:
> 
> template <>
> struct STRUCT_TYPE<TYPE>
> 
> On Tue, Mar 26, 2019 at 12:26 PM John Beard <john.j.beard@xxxxxxxxx> wrote:
>>
>> Hi,
>>
>> Quick question about formatting: clang-format says
>> "AlwaysBreakTemplateDeclarations: false", which can produce things
>> like this:
>>
>> template <typename FOO> void function( int aParam )
>>
>> template <> struct STRUCT_TYPE<TYPE>
>>
>> I think it's clearer if the template declaration is always broken
>> after ("AlwaysBreakTemplateDeclarations: true"):
>>
>> template <typename FOO>
>> void function( int aParam )
>>
>> template <> struct STRUCT_TYPE<TYPE>
>>
>> This keeps the function signature in the "normal" format (i.e. return
>> type on the left), and puts the "struct" or "class", etc, in the
>> "normal"  place too.
>>
>> There aren't that many cases of either, but newline cases win by count
>> (77 to 10). the Uncrustify.cfg file agrees with newline:
>>
>> nl_template_class = force # line 1076
>>
>> The style guide has no mention of it.
>>
>> Cheers,
>>
>> John
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Follow ups

References