[OT] Auto code reformating / one coding style enforcment.
Pragma
ericanderton at yahoo.removeme.com
Mon Aug 14 09:27:27 PDT 2006
Unknown W. Brackets wrote:
> In my code, I use hard tabs for everything and set my tab-width to 4
> spaces.
>
> I've never had trouble with printing code (something I do less often
> than have birthdays, mind you) nor any text editor displaying my code
> weirdly.
>
> Some people hate hard tabs, because they just have to line things up
> after a non-tab character with tabs. I think this is a Bad Thing (TM),
> but if you have to do it, I understand using spaces.
>
> But I've never seen a case where a program would misbehave if the tab
> width was not set to 8.... I just can't wrap my head around the benefit
> of using both tabs *and* spaces.
>
> -[Unknown]
>
>
>> Unknown W. Brackets wrote:
>>> Uh-huh, sure.
>>>
>>> You're usually right, but I don't like having to hit backspace four
>>> times or 1 time alternatively based on my indentation level. That's
>>> just bizarre. I've never seen someone mix tabs like that before...
>>>
>>> Why do you prefer it, if I may ask?
>>>
>>> -[Unknown]
>>>
>>>
>>>> It works just fine when you set tabs to be 8 characters, as god
>>>> intended them to be.
>>
>>
>> Because it isn't screwed up when you type it to the screen or the
>> printer.
For what it's worth, I think Sean is talking about code like this:
switch(x){
case 'foo': break; // 2 tabs
case 'something': break; // 1 tab
}
On my display, with tab=8 spaces in Thunderbird, the 'break' statements
all line up perfectly. If your viewer has it set to something else (say
4 spaces), it doesn't look right. So its the /internal/ indentation
that fails here, as the left column will always look clean.
IMO, this is what code beautifiers are for. I'm not going to worry
about inconsistent tabbing and spacing in any of my projects until
release time comes around anyway. ;)
--
- EricAnderton at yahoo
More information about the Digitalmars-d
mailing list