From: Randy Dunlap on
On Sat, 17 Jul 2010 11:21:03 +0200 Krzysztof Halasa wrote:

> Dimitrios Apostolou <jimis(a)gmx.net> writes:
>
> > static void update_group_shares_cpu(struct task_group *tg, int cpu,
> > unsigned long sd_shares,
> > unsigned long sd_rq_weight,
> > unsigned long *usd_rq_weight)
> > {
>
> From a technical POV the above should not have any tabs, the parameters
> should be aligned with spaces only.

fwiw, it seems that you agree with Ted.

> The tabs should be used for (syntactic) indentation only.
>
> This way we can display the code correctly with any tab length.

but we know what the tab length is. ;)

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Krzysztof Halasa on
Randy Dunlap <rdunlap(a)xenotime.net> writes:

> fwiw, it seems that you agree with Ted.

That's correct :-)

>> The tabs should be used for (syntactic) indentation only.
>> This way we can display the code correctly with any tab length.
>
> but we know what the tab length is. ;)

We have to, at least for now. Existing tools force it upon us.
But it would be nice if we could use any tab length.
--
Krzysztof Halasa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Ted Ts'o on
On Sat, Jul 17, 2010 at 06:51:46AM -0700, Randy Dunlap wrote:
> On Sat, 17 Jul 2010 11:21:03 +0200 Krzysztof Halasa wrote:
>
> > Dimitrios Apostolou <jimis(a)gmx.net> writes:
> >
> > > static void update_group_shares_cpu(struct task_group *tg, int cpu,
> > > unsigned long sd_shares,
> > > unsigned long sd_rq_weight,
> > > unsigned long *usd_rq_weight)
> > > {
> >
> > From a technical POV the above should not have any tabs, the parameters
> > should be aligned with spaces only.
>
> fwiw, it seems that you agree with Ted.

Actually, what my code use is tabs with a tab stop of 8 followed by
enough spaces (< 7) to align function parameters and to align
open/close parenthesis in C expression line wrap.

The main problem seems to be that Chapter 9 in
Documentation/CodingStyle is written by someone who feels that since
vi makes it easy to only align parameters using tabs, that everybody
should do it the same way as vi. I'm simply challenging Chapter 9 as
being canon. I certainly ignore it, and as a maintainer I tend to
accept either vi or emacs-style indentations with respect to
parameters and C expressions.

- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Krzysztof Halasa on
Ted Ts'o <tytso(a)mit.edu> writes:

> Actually, what my code use is tabs with a tab stop of 8 followed by
> enough spaces (< 7) to align function parameters and to align
> open/close parenthesis in C expression line wrap.

To be honest, I do precisely the same, though I think it's far from
perfect. It's just emacs which can't do better (or I don't know how to
make it do better).

> The main problem seems to be that Chapter 9 in
> Documentation/CodingStyle is written by someone who feels that since
> vi makes it easy to only align parameters using tabs, that everybody
> should do it the same way as vi. I'm simply challenging Chapter 9 as
> being canon. I certainly ignore it, and as a maintainer I tend to
> accept either vi or emacs-style indentations with respect to
> parameters and C expressions.

Fully agreed.
--
Krzysztof Halasa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Dimitrios Apostolou on
On Sun, 18 Jul 2010, Ted Ts'o wrote:
> On Sat, Jul 17, 2010 at 06:51:46AM -0700, Randy Dunlap wrote:
>> On Sat, 17 Jul 2010 11:21:03 +0200 Krzysztof Halasa wrote:
>>
>>> Dimitrios Apostolou <jimis(a)gmx.net> writes:
>>>
>>>> static void update_group_shares_cpu(struct task_group *tg, int cpu,
>>>> unsigned long sd_shares,
>>>> unsigned long sd_rq_weight,
>>>> unsigned long *usd_rq_weight)
>>>> {
>>>
>>> From a technical POV the above should not have any tabs, the parameters
>>> should be aligned with spaces only.
>>
>> fwiw, it seems that you agree with Ted.
>
> Actually, what my code use is tabs with a tab stop of 8 followed by
> enough spaces (< 7) to align function parameters and to align
> open/close parenthesis in C expression line wrap.

FWIW that way will show the parameters unaligned to anyone using a
different tab length. There is one way to align such lines properly:

You indent with as many tabs as the previous line has and you use all
spaces (perhaps more than 8) afterwards, to align parameters where you
want them. In the example above that would use 0 tabs, all spaces...

Unfortunately this style is not the default to any editor I have seen,
even though it really makes code readable with any tab length. Even for
emacs you have to customize your config file:
http://www.emacswiki.org/emacs/SmartTabs


Dimitris

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/