[OT] Auto code reformating / one coding style enforcment.

Regan Heath regan at netwin.co.nz
Mon Aug 14 16:57:11 PDT 2006


On Mon, 14 Aug 2006 09:14:04 -0700, Sean Kelly <sean at f4.ca> wrote:
> Jarrett Billingsley wrote:
>> "Walter Bright" <newshound at digitalmars.com> wrote in message  
>> news:ebp2j7$1o5c$1 at digitaldaemon.com...
>>
>>> It works just fine when you set tabs to be 8 characters, as god  
>>> intended them to be.
>>  Or, you could just set them to 4 characters, and always use tabs.   
>> Then everyone would be able to control the indentation as much as they  
>> want. That's the whole point of using hard tabs in a modern editor.
>
> Hard tabs work okay for leading indentation, but for inner  
> indentation--long function calls, if statements, variable lists,  
> etc--they can render code unreadable if viewed with a different tab  
> width.  Even worse is if in a group project, some people use hard tabs  
> and others spaces, and those using hard tabs have different tab widths.

Simple; don't use hard tabs for internal* spacing, only for leading  
indentation. Use spaces for internal spacing.

* meaning in the middle of a line of text.

>   I've worked on projects like this (including the one I'm on now) and  
> the tabs are a disaster.  Given the relative ease with which modern  
> editors can jump from word to word and eat whitespace, I simply don't  
> understand the attachment to hard tabs.

The attraction is the flexibility to view the code with your preferred  
indentation width/size. It's like defining your constant values at the top  
of your source, eg.

const int TAB_WIDTH = 4;

and using that integer in the code, instead of using the literal value '4'.

Regan



More information about the Digitalmars-d mailing list