3 ms·
I have never seen this work correctly in practice, where a code base with tabs looks "OK" when opened on an editor with a different tab width. E.g. some coding
by hn_throwaway_99 9y ago
I have never seen this work correctly in practice, where a code base with tabs looks "OK" when opened on an editor with a different tab width. E.g. some coding styles will have subsequent lines line up (like multiline method params), and everything looks horrible with a different tab width.
If anyone can post a sizable production code base that uses tabs that DOESN'T look like shit with a different tab width, I'm certainly open to being proven wrong.
- tomsmeding 9y ago> sizeable production code base Here and there's the problem. Too many people with editors that go round replacing N spaces with tabs everywhere to have sane alignment in a code base with >1 developer...
- vvhn 9y agoFreeBSD, Linux ... every UNIX kernel codebase ?
- _IsThisRealLife 9y agoThis feels like a partial proxy question for Unix versus non-Unix development. Unix developers are, in my experience, consistently more interested in configuring their IDEs, which underlies many of the arguments for tabs over spaces.
- hn_throwaway_99 9y agoLinux looks like shit with any tab width besides 8. Simple example: https://github.com/torvalds/linux/blob/master/kernel/livepatch/transition.c https://github.com/torvalds/linux/blob/master/kernel/livepat... Notice there are a couple examples in that code where multiline method calls are meant to line up, and if tabs are not set to 8 they don't line up.
- GuB-42 9y agoThat's the problem with a space-tab mix. I do it myself but it requires a bit of maintenance and I wouldn't trust teammates with it. There will always be some guys who don't understand the idea and mess everything up. In a team environment, now, I wouldn't chose anything but 4 spaces. Speaking from experience. - with anything but 2, 4 or 8 spaces, some guys with incorrectly set up editors will mess everything up. - tabs don't work well for alignment, and as long as you allow the tab character, someone will make a mess. - 2 spaces is not enough to properly distinguish between blocks. - 8 spaces can look very nice if your code is very clean. It won't be the case of your project.