Re: Tabs, spaces, indent and 80 character lines



Benny Halevy wrote:
On Feb. 24, 2008, 7:40 -0800, Richard Knutsson <ricknu-0@xxxxxxxxxxxxxx> wrote:
Krzysztof Halasa wrote:
Richard Knutsson <ricknu-0@xxxxxxxxxxxxxx> writes:

Why hinder a developer who prefer
2, 4, 6 or any other != 8 width?
I guess we could use tabs only at the line start, for indentation
only. Rather hard to implement, most text editors can't do that yet.
You mean for split lines? Hopefully there won't be that many, so there is just to delete the tabs it added and replace it with spaces.

IMO, tabs SHOULD be used for syntactic indentation and spaces for
decoration purpose only. I.e. a line should start with a number of tabs
equal to its nesting level and after that only spaces should be used.
for example, the following code

for (i = 0; i < n; i++) printk("a very long format string", some, parameters);

should be formatted like this:

<tabs...>for (i = 0; i < n; i++)
<tabs...><tab>printk("a very long format string",
<tabs...><tab> some, parameters);

this will show exactly right regardless of your editor's tab expansion setting
as long as you use fixed-width fonts - where the screen width of the space character
is equal to all other characters. Once you start using tabs instead of spaces
to push text right so it appears exactly below some other text on the line above
you make a dependency on *your* editor's tab expansion policy and that's not very
considerate for folks who prefer a different one.
Don't know what to say more then: Yup! :)

But the CodeStyle-document and checkpatch.pl does not agree with that.

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



Relevant Pages

  • Re: Converet plain text to table
    ... then try surrounding the space character (but not the ... by an assortment of spaces and tabs. ... wildcard search by using the expression ... To search for multiple tabs, use an expression like the one above with the ^9 ...
    (microsoft.public.word.newusers)
  • Re: bash: How to make the read built-in read the trailing spaces as well?
    ... Remove the space character from the IFS special variable. ... also want trailing tabs not to be stripped, ... I tend to avoid using the read command as that means you end up ...
    (comp.unix.shell)
  • Re: Tabs, spaces, indent and 80 character lines
    ... I guess we could use tabs only at the line start, for indentation ... as long as you use fixed-width fonts - where the screen width of the space character ... you make a dependency on *your* editor's tab expansion policy and that's not very ...
    (Linux-Kernel)
  • Re: Which editor do you use?
    ... I was thinking it might strike a chord with Jim Leonard. ... other editors with him... ... Recently I had the crazy idea to switch to hard tabs. ...
    (comp.os.msdos.djgpp)
  • Re: Prothon Prototypes vs Python Classes
    ... >> The basic difficulty with tabs is that there are a huge ... You gave the best example by yourself: Use different editors, ... > feature than to add a feature. ... > both have a historical support I'd be wary of removing either. ...
    (comp.lang.python)