Spaces vs. Tabs
-
Color me ignorant :confused:! Why are some people so vigorously opposed to tabs in source code? I came accross this statement at someones "MVP" website... "people who insist on using tabs to layout their code (i.e. bozos)".:mad: <-ouch that's harsh!-> What are the advantages of spaces versus the disadvantages of tabs? "Do not go where the path may lead, go instead where there is no path and leave a trail." - Ralph Waldo Emerson
-
Color me ignorant :confused:! Why are some people so vigorously opposed to tabs in source code? I came accross this statement at someones "MVP" website... "people who insist on using tabs to layout their code (i.e. bozos)".:mad: <-ouch that's harsh!-> What are the advantages of spaces versus the disadvantages of tabs? "Do not go where the path may lead, go instead where there is no path and leave a trail." - Ralph Waldo Emerson
-
Tabs are non-uniform. Some people like setting tabs to 4, others to 3, many to 8. Tim Smith Descartes Systems Sciences, Inc.
:cool: Ahhhhh! Out of the darkness and into the light... Thanks Tim! Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson Paul Lyons
-
Tabs are non-uniform. Some people like setting tabs to 4, others to 3, many to 8. Tim Smith Descartes Systems Sciences, Inc.
-
The problem is when you convert your tabs to spaces, and someone else uses a different tab setting (more or fewer spaces). Alignment problems about. Tabs are better. To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
Not to mention that it's quicker to type one tab than four spaces. And you can use SELECT+TAB and SELECT+SHIFT+TAB to indent/outdent blocks of code quickly.
:cool: -=:suss:=-
Dr David Wulff, Phd Aqkuoerian Sciences dwulff@battleaxesoftware.com Founder of The BLA "Look out Michael, here I come"
-
The problem is when you convert your tabs to spaces, and someone else uses a different tab setting (more or fewer spaces). Alignment problems about. Tabs are better. To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
-
Not true at all. Try a tab setting of 8 and an indent of 4. Tim Smith Descartes Systems Sciences, Inc.
-
The problem is when you convert your tabs to spaces, and someone else uses a different tab setting (more or fewer spaces). Alignment problems about. Tabs are better. To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
our coding standard says, in effect "tabs as spaces. 3 spaces". if everyone has the same setting, there is no issue. -c
Smaller Animals Software, Inc. http://www.smalleranimals.com
-
Color me ignorant :confused:! Why are some people so vigorously opposed to tabs in source code? I came accross this statement at someones "MVP" website... "people who insist on using tabs to layout their code (i.e. bozos)".:mad: <-ouch that's harsh!-> What are the advantages of spaces versus the disadvantages of tabs? "Do not go where the path may lead, go instead where there is no path and leave a trail." - Ralph Waldo Emerson
OK, let's see if I can do an accurate analysis: Spaces Pros - The code looks the same in any editor. - When you move the cursor up and down the file, it stays in the same column (unless the line is too short). Cons - The code is forced to be indented the exact number of spaces desired by its writer. If someone wants to see more or less indented spaces, they can't. - Say you set your editor to insert 4 spaces for every tab. The problem is that if you press Tab and then change your mind, you'll need to press Backspace 4 times to delete it. Tabs Pros - Allows different programmers to view the same code differently, by assigning their own number of spaces for each tab. - Tabs are treated as one character so when you press Backspace, you appear to be deleting several spaces at once. This makes some people (like me) more productive. Cons - They can cause block comments on the right side of the code to not line up properly between different tab settings. This is obvious when you develop a CPP file in DevStudio and then later open it in Notepad. - They look just like spaces so it's hard know that they're there (which I don't care much about). Tabs Rule! Regards, Alvaro
-
OK, let's see if I can do an accurate analysis: Spaces Pros - The code looks the same in any editor. - When you move the cursor up and down the file, it stays in the same column (unless the line is too short). Cons - The code is forced to be indented the exact number of spaces desired by its writer. If someone wants to see more or less indented spaces, they can't. - Say you set your editor to insert 4 spaces for every tab. The problem is that if you press Tab and then change your mind, you'll need to press Backspace 4 times to delete it. Tabs Pros - Allows different programmers to view the same code differently, by assigning their own number of spaces for each tab. - Tabs are treated as one character so when you press Backspace, you appear to be deleting several spaces at once. This makes some people (like me) more productive. Cons - They can cause block comments on the right side of the code to not line up properly between different tab settings. This is obvious when you develop a CPP file in DevStudio and then later open it in Notepad. - They look just like spaces so it's hard know that they're there (which I don't care much about). Tabs Rule! Regards, Alvaro
Click the toolbar button with the little ab with a dot in the middle. That will show you your tabs.
-
Doesn't VC++ auto-format use tabs? In the space/tab issue, I prefer to be a bozo. Thomas
In VC there are 3 tab options, "Keep tabs", "Tab size", and "Indent size". When the indent size isn't the same as the tab size, you get a nasty mixture of the two. Personally, I use tab/indent setting of 4. Most all of my code is in house so I don't care about the rest of the world. Tim Smith Descartes Systems Sciences, Inc.
-
In VC there are 3 tab options, "Keep tabs", "Tab size", and "Indent size". When the indent size isn't the same as the tab size, you get a nasty mixture of the two. Personally, I use tab/indent setting of 4. Most all of my code is in house so I don't care about the rest of the world. Tim Smith Descartes Systems Sciences, Inc.
-
our coding standard says, in effect "tabs as spaces. 3 spaces". if everyone has the same setting, there is no issue. -c
Smaller Animals Software, Inc. http://www.smalleranimals.com
-
Color me ignorant :confused:! Why are some people so vigorously opposed to tabs in source code? I came accross this statement at someones "MVP" website... "people who insist on using tabs to layout their code (i.e. bozos)".:mad: <-ouch that's harsh!-> What are the advantages of spaces versus the disadvantages of tabs? "Do not go where the path may lead, go instead where there is no path and leave a trail." - Ralph Waldo Emerson
The simple answer is that it costs approximately 4 times as much to maintain code than to produce it. I can't remember where I read this, but I'll try and dig up the source. Therefore it makes sense to code in a uniform, developer agnostic manner. That's one reason why programming shops use coding guidelines. Spaces are by definition independent of tab sizes, and are hence independent of the developer's preferences. Similar arguments may be made for using Hungarian notation, JavaDoc style comment headers, etc. If you're the only person who will create/modify a code base, you should feel free to use tabs (or spaces). Further reading
/ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com
-
our coding standard says, in effect "tabs as spaces. 3 spaces". if everyone has the same setting, there is no issue. -c
Smaller Animals Software, Inc. http://www.smalleranimals.com
if everyone has the same setting, there is no issue. That's right, but... Lot's of people use a tab-setting of 4, and I only use 2. When we all use tabs, they see my code like they want, and I can look at their code the way I like it. :) I would really hate to be forced to use 4 spaces... X| - Anders Money talks, but all mine ever says is "Goodbye!"
-
if everyone has the same setting, there is no issue. That's right, but... Lot's of people use a tab-setting of 4, and I only use 2. When we all use tabs, they see my code like they want, and I can look at their code the way I like it. :) I would really hate to be forced to use 4 spaces... X| - Anders Money talks, but all mine ever says is "Goodbye!"
-
Color me ignorant :confused:! Why are some people so vigorously opposed to tabs in source code? I came accross this statement at someones "MVP" website... "people who insist on using tabs to layout their code (i.e. bozos)".:mad: <-ouch that's harsh!-> What are the advantages of spaces versus the disadvantages of tabs? "Do not go where the path may lead, go instead where there is no path and leave a trail." - Ralph Waldo Emerson
-
Color me ignorant :confused:! Why are some people so vigorously opposed to tabs in source code? I came accross this statement at someones "MVP" website... "people who insist on using tabs to layout their code (i.e. bozos)".:mad: <-ouch that's harsh!-> What are the advantages of spaces versus the disadvantages of tabs? "Do not go where the path may lead, go instead where there is no path and leave a trail." - Ralph Waldo Emerson
I hate spacees in code bcause it's a pain to manipulate - hwne youhave to prat about backspacing several times when once would've done if the source had been formatted with tabs. Just my £0.02 :) -- Andrew.
-
Color me ignorant :confused:! Why are some people so vigorously opposed to tabs in source code? I came accross this statement at someones "MVP" website... "people who insist on using tabs to layout their code (i.e. bozos)".:mad: <-ouch that's harsh!-> What are the advantages of spaces versus the disadvantages of tabs? "Do not go where the path may lead, go instead where there is no path and leave a trail." - Ralph Waldo Emerson
If you like a certain tab feel then when you start set your "Tabs are Spaces" if you use Visual Studio, then set it to what you want. Let us say 2, as I do. Then when you are done coding you can go and click Edit->Advanced->Tabify and it will change all of your groups of 2 spaces to tabs (I believe it does all of them, maybe just leading...I dont know). Then when you distribute your code (if you care) then whoever maintains it can see it how they want. That way you don't end up with the "mix" of spaces and tabs that I *ALWAYS* end up with when I dont set tabs to spaces. ;P Plus - I like to open my .cpp files in Notepad from time to time and as we all know the tabs in notepad are 8 wide, and most of my code gets scrolled. That angers me! :mad: Peace! ---- Xian
-
The problem is when you convert your tabs to spaces, and someone else uses a different tab setting (more or fewer spaces). Alignment problems about. Tabs are better. To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
Tabs are better. Exactly. Back in the dim dark days of C I used spaces. If I added another if, while, for etc. statement around a block of code it was a pain in the arse indenting using the space key. Now in C++ adding // comments to the front of code has no effect on formatting if I use tabs but screws everything if I am using spaces. If you use any value other than 4 for your tabs you are an idiot. :-D Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone