Mail Archives: djgpp/2000/04/10/04:13:13

Date: Mon, 10 Apr 2000 08:47:55 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Richard Slobod <71231 DOT 104 AT compuserve DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Bracketing: A Matter of Style
In-Reply-To: <>
Message-ID: <Pine.SUN.3.91.1000410084731.19649N-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 9 Apr 2000, Richard Slobod wrote:

> >The problem I was referring to is that the indentation gets completely
> >scrwed up if the sources are vewed with a different setting of a tab
> >width, or printed on a printer.
> The indents get shrunk or grown, but that's a far cry from "completely
> screwed up".  We're talking about the difference between
> void sayhello(void) {
>   printf("Hello\n");
>   }
> and
> void sayhello(void) {
>         printf("Hello\n");
>         }
> Neither of those looks screwed up to me.

You took a trivial example.  Try a real-life program, and you'll see
what I mean.  The problem happens because indentation uses blanks and
spaces together.  Tabs change their size, but blanks don't.

> As for printing, if your editor doesn't support directly printing the source
> using the current tab size, you can always pass it through a filter.

IMHO it's not nice to force other users to use filters and other
tricks just because you like your tabs to be of non-default size.

If you want to have some specific indentation style, it is much better
to change the indentation defaults than to change the tab size.  That
works for you and for everyone else.

> >> Also note that 1) this isn't likely to be an issue if you're the only one
> >> who ever works with the source files in question and 2) it's trivial to
> >> replace the tabs with the desired number of spaces if you should need to.
> >
> >The replacement with spaces should be done by whoever changes the tab
> >size.
> Not necesarily.  If you want to make certain that anyone viewing the code
> knows what tab size you used, it's easy enough to stick a comment to that
> effect in the file.

Again, you force the people who read your code to do something on your
behalf.  It doesn't help them to like your code.

> Also note that there's no reason why two people working on the same source
> code file necesarily have to view it using the same tab size

See above: you want them to understand the structure of the source
using the indentation as a cue.

> >But the number of editors which allow to indent with spaces
> >only is much smaller than the number of editors which allow to change
> >the tab size, and people tend to forget to do it, even if it is
> >supported by the editor.
> I'm not quite sure what you're saying here.

I'm saying that if you change the tab size, there are good chances
that recipients of your program will not be able to do the same on
their side, and will therefore see a messed-up indentation.

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019