if block style when condition spams to multiple lines.

Geyslan G. Bem geyslan at gmail.com
Fri May 20 08:37:14 EDT 2016


2016-05-20 8:43 GMT-03:00 Daniel Baluta <daniel.baluta at gmail.com>:
> On Thu, May 19, 2016 at 9:07 PM, Daniel. <danielhilst at gmail.com> wrote:
>> What is the preferred way to ident if statement when the condition
>> spams to multiple lines, ex:
>>
>> if (cond1 &&
>>     cond2 &&
>>     cond3) {
>>         ...
>>         ...
>> }
>
> ^ this one is preferred.

That's right. This is the chosen one.
But I think it's good you analyze the tree style and get more info
from the respective maintainers, since they tend to use different tab
indentations based on the up line.

If you use emacs, just config this elisp and max your power. ;)
http://www.kernelhub.org/?msg=953609&p=2

Just for record, that elisp patch wasn't sufficiently discussed so it
still can be merged. It depend on you emacs knights. o/

>
>>
>> or
>>
>> if (cond1 &&
>>     cond2 &&
>>     cond3)
>> {
>>    ...
>>    ...
>> }
>>
>> or if only one statement inside body
>>
>> if (cond1 &&
>>     cond2 &&
>>     cond3
>>         ...
>>
>> Also, usualy, I align the remaining lines from codition to one
>> column after the parenthesis that starts the condition and usually
>> I need spaces to do that. Is that okay? With no spaces would be:
>> if (cond1 &&
>>         cond2)
>> {
>>         ...
>>
>> Regards,
>> --
>> "Do or do not. There is no try"
>>   Yoda Master
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
Regards,

Geyslan G. Bem
hackingbits.com



More information about the Kernelnewbies mailing list