Click to See Complete Forum and Search --> : Tab or No Tab :: C++ Compilers
kuphryn
02-07-2002, 10:37 PM
Hi,
I program using Visual C++, vi, some occassionally using KDevelop. I usually experience problems with tabs and spaces. I use tab (3 spaces) in Visual C++. However, vi almost always open the source files with random spaces.
In general, do developers use spaces instead of tabs?
Thanks,
Kuphryn
mefisto3
02-07-2002, 11:21 PM
Usually use spaces. Tabs can always screw up when you move the code to a different editor or machine. Most of editors now support an option to change the tabs to spaces.
Strogian
02-08-2002, 04:31 PM
Here's my advice. You can use tabs or spaces (or a combination of both, as vi will do with ^T and shiftwidth), BUT a TAB is eight spaces. Always. Do not screw with that unless you absolutely have to (i.e. director of the project tells you to).
kuphryn
02-08-2002, 04:48 PM
Thanks everyone.
I set Visual C++ to use *spaces* when I hit the tab key. This method works great. Thanks!
Kuphryn
I'd say always use spaces. As implied above, TABs are sometimes different spaces - either in different software or on different OSes. (usually 4 or 8, though).
Since many editors won't show you what's a tab or space, it's much safer to just stick to spaces. Reading through our source code, it's obvious when 2 people have been in a file and used different editors... Very ugly.
Besides, indenting with 3-space increments looks so much better, especially when sticking to 80-character lines. Otherwise you end up with a column down the right margin :P
------------------
The price of freedom is high.