delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/10/14:40:27

From: 71231 DOT 104 AT compuserve DOT com (Richard Slobod)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bracketing: A Matter of Style
Date: Mon, 10 Apr 2000 18:33:40 GMT
Organization: Warwick Online
Lines: 42
Message-ID: <38f21136.9841813@news.warwick.net>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000410172457 DOT 24866I AT is>
NNTP-Posting-Host: m203-1-p45.warwick.net
X-Trace: news.warwick.net 955391710 10647 208.242.203.50 (10 Apr 2000 18:35:10 GMT)
X-Complaints-To: usenet AT news DOT warwick DOT net
NNTP-Posting-Date: 10 Apr 2000 18:35:10 GMT
X-Newsreader: Forte Free Agent 1.21/32.243
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
>
>On Mon, 10 Apr 2000, Richard Slobod wrote:
>
>> Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
>> 
>> >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.
>> 
>> Huh?  If you indent with tabs, then you indent with tabs, not a mixture of
>> tabs and spaces.
>
>It depends on the indenting style.  If every indentation level is 2 
>columns deep, then the 4th level will use a tab, the 5th will use a tab 
>and a space, etc.

But if you were messing around with the tab size you obviously wouldn't
indent like that; you'd make every indent level a tab and just set the tab
width to your desired indent size.

>Using a tab for each level wastes the line width too quickly, IMHO.

Not if you set the tab size smaller.  That was my original point:  if you
indent with tabs, you can have the indents as wide or as narrow as you wish.

>> Could you post an example of what you're talking about?
>
>This is from the DJGPP library (file name fflush.c):

[fairly lengthy code listing snipped]

But that code was clearly formatted with the inherent assumption that tabs
are exactly equivalent to eight spaces; someone using a nonstandard tab size
simply wouldn't have written it that way.

Mixing tabs and spaces in this way will indeed cause parts of the code to be
misaligned where that assumption is false, but that's not an issue if you
consistently indent with tabs only.  (For that matter, IMHO, if you want
something that's guaranteed to be exactly eight spaces wide, it's safest to
simply use eight spaces.  Admittedly, that will increase the file size a
bit.)

- Raw text -


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