-
Website
http://zef.me/ -
Original page
http://zef.me/archives/2005/04/06/code-indentation-tabs-vs-spaces/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
mattmcknight
2 comments · 2 points
-
Joseph Fung
1 comment · 1 points
-
Steve Klabnik
1 comment · 1 points
-
eladmeidar
3 comments · 1 points
-
tphyahoo
1 comment · 2 points
-
-
Popular Threads
-
Models are Programs
3 weeks ago · 5 comments
-
Event-Programming: The Highway to Concurrency?
3 weeks ago · 2 comments
-
Models are Programs
int[] a = int[] example{ 1, 2
3, 4};
Some people like to have the 1 and 3 in one column for a better layout.. with tabs this can't be done properly
Ideally, in your case the editor should choose to indent with tabs up to the indentation of the previous line, and then continue with spaces. However, I don't know of any editor that is that clever... if any editor can, it will probably be called emacs ;)
The issue isn't having to add spaces, for that is what has to be done, but they won't align anymore when tabs are of different width on another setting ;-)
I'm a spaces guy myself. Only problem I get is that I have to use ':s/^/[4 spaces]/g' instead of ':s/^/^I/g' in vi. Old habits die hard
Personally I use tabs with an indent of 2...
2. Not all editors allow you to define the width of your spaces. Notepad is a good example. Also, who says you're always working on your own PC? What if you're working on an editor you're not familiar with? Are you going to spend half an hour looking for the tab-setting so you can go back from, say, 4 spaces to your preferred 3?
I never heard a good argument in favor of tabs. The most common and lame one is 'I have to delete n more characters when editing code'.
"My code was hard to write, it should be hard to understand" Plan 9 Kernel