Re: How to change the length of "\t"?
On Jul 15, 7:01 pm, "Alf P. Steinbach" <al...@start.no> wrote:
* James Kanze:
Using anything other than 8 for tabstops is a dumb thing,
since that's the universal defacto standard today (and you
certainly don't look at text only in an editor).
I'm sorry, but that's not correct. The de facto Windows
standard is 4 character positions per tab stop. Tools from
early eighties (e.g. Notepad) excepted.
Windows doesn't make the standard; it was established long
before windows appeared.
And a quick check on my Windows machine showed it using 8 as
well (under Windows XP). So I'm not sure what you're talking
about when you speak of 4; until your statement above, I had
assumed that it was a personal configuration of the editor.
If they did try to make it 4... Trying to change such an
established standard is almost as dumb as another systems
attempt to change the de facto standard for line endings (which
is, of course, CR,LF).
Regarding what's dumb, the *nix de facto standard of 8
character positions per tab stop is clearly dumb, since it's
impractical for anything,
Historically, I don't know where the 8 comes from; it was the de
facto standard before I got into computer programming, and that
goes back some. Before Windows or Unix.
and the lack of a standard for indicating the tab stop and
indentation settings of source code is clearly dumb (would be
a good candidate for a new C++ preprocessor directive :-)).
But I'm pretty sure that folks who have not enjoyed the
benefits of working in an environment with consistent 4-tabs,
actually using tabs in source code, will not immediately grasp
why any of the abovementioned should be dumb. After all, we
manage quite fine without using tabs at all, thank you.
Yes. You shouldn't use tabs in your source code; that much is
clear. And there's no problem with an editor doing whatever it
wants with the tab key (emacs reindents the line according to
its idea of how it should be indented). The problem is when the
editor (or any other program) inserts a tab character in the
code, or displays an existing tab character as if tab stops were
anything else but 8.
If you're using an indentation other than 8 (and 8 is too
big), then you have to use some spaces for the indentation.
(Because people are stupid enough to set tabstops in their
editor at something different than 8, I've given up using
tabs at all in text files. Just spaces, so everyone will
see the code as it was meant to be formatted.)
Using spaces instead of tabs is a good recommendation for
cross-platform work, and it is, for example, the solution
adopted by Boost.
Not just cross platform. It comes into play anytime you do a
diff or whatever Windows equivalent of grep is. (I'll admit
that I'm lazy---rather than learn the Windows tools for such
essential tasks, I just installed a Unix tool kit. Which is far
from ideal, but since I already know it, and don't work enough
under Windows to justify learning anything else...)
Letting the editor indent however much you want (I like four,
but three or five is also acceptable) is also a good thing; just
get everyone on the project to agree. And make sure that when
the indentation gets into the files, it's as spaces, not tab
characters, or you'll run into problems downstream.
James Kanze (GABI Software) email:email@example.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34