by cutie · 14y ago · 0 comments
For example, one person has tabs set to the size of 8 chars and writes a lengthy script. A second person comes along with tabs set to 5 chars and makes changes. The indentation could well be wrong because they see the same file differently. Sometimes you get lucky and you get errors immediately, but other bugs can lurk... like the second statement under an if block for example. Should it be included in the if or not? Bug.
Therefore, tabs aren't worth the trouble they can potentially cause. Never mix them with spaces either.
Also, using spaces is not difficult in a modern editor. You don't have to actually type four spaces each level. You set tabs as 4 spaces in the prefs and then every time you hit the tab key you get 4 spaces instead, and when you hit the backspace it removes 4 spaces (geany does this).
Whatever you use, I suggest turning on the display of whitespace in your editor. It will then show tabs as "--->" and spaces as a dot. Change the color in the highlighting preferences to be very subtle so it does not overwhelm the code. It will help you keep every file you work on consistent and such errors a thing of the past.
Plus, each developer has the freedom to choose how many spaces a TAB is - I like 8 when I'm using my big monitor, but I prefer 4 on my laptop. With TABs, I can see it both ways depending on the machine.
On the off chance that I'm ever actually editing in a smaller window, I can even set it to 2 characters instead, but when I open that file again on another machine, I can see it as 4 or 8 characters.
It might not be the case for everyone, but my laptop screen is 1920x1080 and has more room for text than I can use. In a three way merge your strategy could help me perhaps.