Re: coding style for long conditions (WAS: Re: [PATCH 25/90] ... blinky leds!!)

Jan Engelhardt
2007-04-06T22:07:47Z

Hello David,

On Apr 6 2007 13:57, David Brownell wrote:
>> though I do not speak for
>> them, seem to do it much the way I described, judging from the code they
>> wrote/write.
>
>Your eyes are broken then ...

Sorry? I could have simply told you to look into kernel/signal.c LINE
220 (that's in the recalc_sigpending_tsk() function), to see that
THERE IS code which uses /^\t+\x20/ to indent wrapped if continuation
lines:

fastcall void recalc_sigpending_tsk(struct task_struct *t)
{
if (t->signal->group_stop_count > 0 ||
(freezing(t)) ||
PENDING(&t->pending, &t->blocked) ||
PENDING(&t->signal->shared_pending, &t->blocked))
set_tsk_thread_flag(t, TIF_SIGPENDING);
else
clear_tsk_thread_flag(t, TIF_SIGPENDING);
}

And this is not the only function. But since I figured you would
anyway object despite what I say...

>or maybe you're focussing exclusively
>on code that violates the most basic coding guidelines like:

...I wrote that script that actually proves my point (minus script
bugs - errare est humanum) that \t+\x20 is PREDOMINANT in kernel
code. Whether that invalidates what CodingStyle says is another
debate (which at best Randy just decides and sends a patch for which
is then hopefully committed instantly).

> if (...) {
> THAT WAS ONE MORE TAB
> }
>
>and
>
> for (...) {
> THAT WAS ALSO ONE MORE TAB
> }
>
>Come on, stop wasting everyone's time with utter nonsense.

I was never debating these two things. I was, however, if you have
not noticed yet, about wrapped if lines:

if (foo ||
continuation_with_2_or_more_spaces)
code_with_1_tab;
and
if (foo ||
continuation_with_2_tabs)
code_with_1_tab;

The former is what kernel code does "**TODAY**".
Thank you.
Jan
--