[comp.lang.c] Tabs vs. Spaces

dennis@tifsie.UUCP (Dennis Draheim) (12/29/88)

in article <WJC.88Dec27163645@ho5cad.ho5cad.ATT.COM>, wjc@ho5cad.ATT.COM (Bill Carpenter) says:
> In-reply-to: eric@snark.UUCP's message of 22 Dec 88 02:40:53 GMT
> 
> In article <eWLGd#1tHJD6=eric@snark.UUCP> eric@snark.UUCP (Eric S. Raymond) writes:
> 
>> In general, I code in what I think of as "BSD/Allman" style with 4-space
>> indent:

So do I.  That means there are at least 2 sane people in the world. :-)

> Given the chance, I always object to indents termed in numbers of
> spaces.  ...

Why?

> Are there still text/code tools thought to be reasonable which do not
> allow you to set your own sizes for tabs?

How about printers?  Especially SHARED printers?  Resetting tab stops is
a pain...it's easier to leave tab stops at 8 for those who use them.  So
if I want my code at 4-space indentation, I either have to 'expand -4' it
every time I print it, or use spaces.

> Even if we can't solve where the curly braces go, world peace, and
> other hard problems, let's at least write this one off.  Indenting is
> done with tabs, right?  Not spaces,

Wrong.  Tabs are inherently evil.  Some equipment doesn't understand them, 
and much of the rest either assumes they are set at 8 or requires much
initialization and reinitialization when shared between people whose ideas
of the "right" indentation level vary.

> and not combos of spaces and tabs, right?

I'll give you this one.  If there's anything worse than straight tabs,
its a combination of the two.  Guaranteed to drive anyone nuts in an editor.

peter@ficc.uu.net (Peter da Silva) (12/30/88)

In article <570@tifsie.UUCP>, dennis@tifsie.UUCP (Dennis Draheim) writes:
> in article <WJC.88Dec27163645@ho5cad.ho5cad.ATT.COM>, wjc@ho5cad.ATT.COM (Bill Carpenter) says:
> > In-reply-to: eric@snark.UUCP's message of 22 Dec 88 02:40:53 GMT
> > 
> > In article <eWLGd#1tHJD6=eric@snark.UUCP> eric@snark.UUCP (Eric S. Raymond) writes:
> > Given the chance, I always object to indents termed in numbers of
> > spaces.  ...

> Why?

Because an indent is a single logical unit. Now I'm going to proceed to
either blow your mind or get myself locked away.

I prefer to edit code at ts=4, but I hate reading printed code like that.
I much prefer printing my code at ts=8. It makes it mor readable on the
more extensive printed page.

> Wrong.  Tabs are inherently evil.

Nonesense. Tabs are just a convention. Indenting one tabstop is just a
convention and a sop to the fact that nobody has ever produced a popular
language-directed editor for 'C'. If your equipment can't deal with them,
just say 'stty tabs'.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180.   `-_-'
Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net.                 'U`
Opinions may not represent the policies of FICC or the Xenix Support group.

eric@snark.UUCP (Eric S. Raymond) (01/02/89)

In article <2584@ficc.uu.net>, peter@ficc.uu.net (Peter da Silva) writes:
>                                    Indenting one tabstop is just a
> convention and a sop to the fact that nobody has ever produced a popular
> language-directed editor for 'C'.

GONG! Ever heard of `electric-C-mode', Mr. da Silva? Your friendly local EMACS
will have one. It maintains indent levels with the greatest of ease, using
optimum mixes of tabs and spaces to do so (it can be told to use spaces only).
It has a reindent-block command. And it can be configured to indent for most C
coding styles. I never leave $HOME without it...
-- 
      Eric S. Raymond                     (the mad mastermind of TMN-Netnews)
      Email: eric@snark.uu.net                       CompuServe: [72037,2306]
      Post: 22 S. Warren Avenue, Malvern, PA 19355      Phone: (215)-296-5718

peter@ficc.uu.net (Peter da Silva) (01/03/89)

In article <eaAZq#3sfeyE=eric@snark.UUCP>, eric@snark.UUCP (Eric S. Raymond) writes:
> In article <2584@ficc.uu.net>, peter@ficc.uu.net (Peter da Silva) writes:
> >                                    Indenting one tabstop is just a
> > convention and a sop to the fact that nobody has ever produced a popular
> > language-directed editor for 'C'.

> GONG! Ever heard of `electric-C-mode', Mr. da Silva? Your friendly local EMACS
> will have one.

I don't count a full-blown Emacs as a popular editor, seeing as how it won't
run on anything with less than a couple of meg of virtual memory all for
itself to keep it cozy at night. Remember, most of the UNIX systems in the
world are running on brain-damaged intel machines.

Most of the Emacses out there (including my freindly local Emacs) have a
sort of a 'C' mode. I hope you're not talking about that. It doesn't do
anything with the greatest of ease.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180.   `-_-'
Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net.                 'U`
Opinions may not represent the policies of FICC or the Xenix Support group.

eric@snark.UUCP (Eric S. Raymond) (01/05/89)

In article <2601@ficc.uu.net>, peter@ficc.uu.net (Peter da Silva) writes:
> Most of the Emacses out there (including my freindly local Emacs) have a
> sort of a 'C' mode. I hope you're not talking about that. It doesn't do
> anything with the greatest of ease.

I was referring to GNU Emacs. Its C mode is pretty nice, and I have made it
nicer (my changes may be incorporated in version 19, I'm waiting to find out).
Joe-Bob Briggs says: check it out...
-- 
      Eric S. Raymond                     (the mad mastermind of TMN-Netnews)
      Email: eric@snark.uu.net                       CompuServe: [72037,2306]
      Post: 22 S. Warren Avenue, Malvern, PA 19355      Phone: (215)-296-5718

ddb@ns.UUCP (David Dyer-Bennet) (01/05/89)

In article <2601@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
:I don't count a full-blown Emacs as a popular editor, seeing as how it won't
:run on anything with less than a couple of meg of virtual memory all for
:itself to keep it cozy at night. 

Epsilon runs happily in 256k on messy-dos, and does indenting just fine,
thank you.  For that matter, MINCE on a 64k CP/M system did 
minimally-useful indenting.  

For that matter, all that's really needed is a function to "indent under"
(match indenting on the previous line), and a "delete-backward-hacking-tabs".
Then mixed-character indenting is easy.  Not difficult technical problems.

-- 
	-- David Dyer-Bennet
	...!{rutgers!dayton | amdahl!ems | uunet!rosevax}!umn-cs!ns!ddb
	ddb@Lynx.MN.Org, ...{amdahl,hpda}!bungia!viper!ddb
	Fidonet 1:282/341.0, (612) 721-8967 hst/2400/1200/300

peter@ficc.uu.net (Peter da Silva) (01/07/89)

In article <1058@ns.UUCP>, ddb@ns.UUCP (David Dyer-Bennet) writes:
> In article <2601@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
> :I don't count a full-blown Emacs as a popular editor, seeing as how it won't
> :run on anything with less than a couple of meg of virtual memory all for
> :itself to keep it cozy at night. 

> Epsilon runs happily in 256k on messy-dos, and does indenting just fine,
> thank you.  For that matter, MINCE on a 64k CP/M system did 
> minimally-useful indenting.  

Where can I get Epsilon or MINCE for SVR2 and SVR3 on a 68000 and a 68020
respectively, and for SIII on 80286 and 80386? Most 'C' code is written on
UNIX, and if it's not available on UNIX (vi or Emacs, basically) it doesn't
really matter.

Yes, I realise this reduces my argument to "vi and small Emacses don't
do an adequate job of handling non-tab indents", but that's the bottom
line. Most 'C' code is being written on machines where 8 character tabs
are the only way to go.

> For that matter, all that's really needed is a function to "indent under"
> (match indenting on the previous line), and a "delete-backward-hacking-tabs".

I won't go into the details here (argument by reference to nonexistent
authority), but this is not adequate. I've written macros to do this
sort of thing (in vi, even), and have never been as satisfied with it
as just doing it myself a tab at a time. How do you change your indenting
on the fly as the scope of your programming chages?
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180.   `-_-'
Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net.                 'U`
Opinions may not represent the policies of FICC or the Xenix Support group.