The D Style and tab sizes

Stewart Gordon smjg_1998 at yahoo.com
Sat Sep 9 16:47:21 PDT 2006


http://www.digitalmars.com/d/dstyle.html

"Adhering to the D Style, however, will make it easier for others to 
work with your D code and easier for you to work with others' D code."

"# Hardware tabs are at 8 column increments.
# Each indentation level will be four columns."

Firstly, what is a "hardware tab"?  Secondly, these two quotations seem 
contradictory.

Making your code come out a mess in any editor that isn't configured 
with a tab size of 8 is certainly not going to make it easier for others 
to work with your D code.  On the contrary, it is much easier if people 
can read your code regardless of how their editors are configured.

Most programmers, at least AFAIK, will decide on an indentation size 
that they feel comfortable with and configure their editors to use this 
as the tab size.  Of course, there will be some who indent with spaces, 
not tabs, and some whose editors (either by user pref or by being 
hard-coded to) automatically convert all tabs to spaces, but that's an 
aside.

AFAIC, people who use tabs but indent by half a tab at a time are 
painting themselves into a corner.  We should aim to write code that'll 
be readable in any editor, whatever its tab size setting.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d mailing list