3 ms·
No, that's what a coding style is for. Either specify tabs or spaces and you enforce it A tab means 8 spaces. If you want your editor to show something differe
by raverbashing 13y ago
No, that's what a coding style is for. Either specify tabs or spaces and you enforce it
A tab means 8 spaces. If you want your editor to show something different that's up to you, but it's non standard.
- pjmlp 13y agoWhich only works on small hobby projects, startups and a few companies of the likes of Google, Facebook and friends. On the real corporation world, it is a whole different thing. Good luck enforcing coding styles across multi-site projects, with rotating developers and off-shoring subcontractors.
- raverbashing 13y agoYes, it is hard. There are ways of putting a trigger in your source code control to enforce it, but it's not always possible. Still, projects like this have something very thorough and that goes much deeper than just tabs vs spaces: http://www.stroustrup.com/JSF-AV-rules.pdf http://www.stroustrup.com/JSF-AV-rules.pdf
- sesqu 13y agoA tab does not mean 8 spaces. That's the whole problem, people keep thinking tabs and spaces have an exchange rate. If you have a source file with only tabs (and you should, then nobody has to run an re-indent script because they can't read it), you should be inserting tabs. If you have a source file with only spaces, you should map the tab key to insert the correct amount of spaces before editing. If you have a source file with both tabs and spaces for indentation, you should re-indent.
- raverbashing 13y agoFor all purposes, yes it means 8 spaces. Type this in a bash terminal: $ printf '1234567890\n\tx\n' For the second paragraph: I couldn't agree more. There's even some "geniuses" that indent python with the 1st level being 4 spaces and the second level as a tab. * sigh *. Really.
- cocoflunchy 13y agoWhat about this? printf '1234567890\n1\tx\n12\tx\n123\tx\n1234\tx' 1234567890 1 x 12 x 123 x 1234 x Tabs are not fixed width, that's the whole point of their existence.
- raverbashing 13y agoYes, this is how it works for alignment, so you don't need spaces to align the x there This is a non issue when you have nothing to the left of the code (that is, when indenting) (and the x should be under the 9 btw)