Tabs vs Spaces

2011-04-24 00:37:36 GMT

Ok, this is some serious shit that drives me crazy. The reason why you should never, and I mean never and let me emphasize NEVER in your entire life use tabs for indentation is because:

As a last word, it's not possible to avoid using spaces for indentation in such scenarios:

<tab><tab><tab>function_call(arg1, arg2, arg3,
<tab><tab><tab>              arg4, arg5, arg6);

Long life to spaces!


Comment written by Olivier at 2011-04-26 01:43:07 GMT:

I'm using tabs to indent my code... hahahaha <- evil laugh :-P


Comment written by Laci at 2011-04-26 09:53:05 GMT:

Olivier: Then you're beyond any help! ;)


Comment written by SzG at 2012-04-08 20:18:53 GMT:

The entire Linux kernel uses Tabs for indentation.
To find out why, get the source code and read Documentation/CodingStyle.
It is a very funny and wise piece of literature.

Your problem is not Tabs for indentation. Your problem is people who've never learned how to use a decent text-editor like vi, vi, vi or vi. The trick is this (~/.vimrc):

set autoindent
set copyindent

Comment written by Laci at 2012-04-09 01:26:56 GMT:

I've had a great time reading Documentation/CodingStyle and felt in love with it.

Using tabs for identation could probably work for me if *all* the editors handled the mixture of tabs and spaces in a unified way and if *every* people *always* cared about using tabs and spaces the right way. Unfortunately, it's not the case.

My other gripe is not using curlies for one-liner blocks. It may seem like a good idea first but someone will screw things eventually when extending such a one-liner block and forgetting to add the missing curlies.

Apart from that this whole guide is pure gold which sould be seen by every programmer. K&R is also my style, by the way.

PS: I'm not a vi user, but I used to use Emacs. :)