Re: Indentation in source code files
By: Nightfox to jagossel on Fri Aug 25 2017 11:25 am
Very hard to choose... Where I work, the ABSOLUTE coding standard is ta
bs,
amd that is taken very seriously.
However, my personal preference is 2 spaces.
My workplace doesn't have a policy on it, but I tend to use tabs. For my personal projects, I used to indent with spaces (I usually used 3 spaces), b
ut
I've started using tabs. It seems easier to be consistent when using tabs,
and
also with tabs, editors often give you the option on how much space it will
use
to represent a tab. For my Synchronet scripts/mods, I used to use Notepad2
(in
Windows) to edit them, and eventually switched to Notepad++. Notepad++ made
it
more obvious that indentation was inconsistent in many places - Some code ha
d a
mixture of tabs and spaces, which was hard to tell with Notepad2 because the
y
looked similar and the indentation looked good with Notepad2.
The tab width preferemce was the exact argument made why it's an absolute coding standard where I work, and it does work really well in that aspect,
and the 2-spaces standard is left over feom when I was programming for fun in QBasic while I was in high school (probably just datdd myself by saying that :D); and I think it's a standard from Code Guide (I forget the exact name).
You can view whitespace characters in any decent text editor and IDEs. In Notepad++, I forget where it is. WinMerge has that option as well.
-jag
Code it... Script it... Automate it!
---
■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com