Re: coding style for long conditions

Scott Preece
2007-04-09T15:45:52Z

On 4/6/07, Roland Dreier <rdreier@cisco.com> wrote:
> [I can't believe I'm stepping into an indentation flamewar, but here goes...]

> that the line with "bar" on it is properly indented with one tab
> (since it is part of the if statement that is also indented one tab),
> and then four spaces are used to align the "bar" with the previous
> line. So only tabs are used for indentation, and the spaces after the
> tab are used for alignment, and the letter of the law is observed.
>
> If you have a git tree handy, you can do "git show 68380b58" and see
> that Linus himself wrote:
>
> if (get_wq_data(work) == cwq
> && work_pending(work)
> && !list_empty(&work->entry)) {
>
---

I'm happy to see Linus did it exactly the way I would have...

So, perhaps the rule in CodingStyle should be clarified to say that
indentation is used to show nesting depth and always expressed in TAB
characters, but additional spacing may be used following the
structural TABs to appropriately format continuation lines...

scott