The D Style and tab sizes

Regan Heath regan at netwin.co.nz
Sun Sep 10 15:02:40 PDT 2006


On Sun, 10 Sep 2006 11:13:11 -0700, Walter Bright  
<newshound at digitalmars.com> wrote:
> Thomas Kuehne wrote:
>> Walter Bright schrieb am 2006-09-10:
>>> Stewart Gordon wrote:
>>>> 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.
>>> There's no way to do that and have hard tabs. The only way to achieve  
>>> that is by using spaces only. Using spaces only is one way to conform  
>>> to the D style guide.
>>  What editor/IDE are you using?
>>  gedit(GNOME), kedit(KDE) and vi/nano(shell) are all basic editors and
>> all have a way to set the display with of "\t" characters. Microsoft's
>> Notepad is probably the only default editor incapable of changing the
>> display with of "\t".
>
> That's true, but is not the problem. Consider:
>
> 	foo();	 		// comment
> 	bar + 4 *18 - foo();	// comment
>
> Suppose \t's are used to line up the comments.

That's where the mistake/error has been made, NEVER use \t to line text  
up, ALWAYS use space.

Tabs are for indentation only, or in other words, indenting the text  
essentially defining your left hand margin, nothing else!

As long as you only use tabs to indent the left hand margin, and spaces to  
align text people can use any tab size they like and it will always work  
perfectly.

Regan



More information about the Digitalmars-d mailing list