|
Indentation (4 spaces vs 8 spaces) |
decepto
Member #7,102
April 2006
|
A couple questions: 1. Do you use hard tabs or soft spaces for indentation - and why? Personally, I use soft spaces with an indent of 4 for every programming language. Trying to use 8 space indentation is just too hard when I try to keep my lines less than 80 characters. -------------------------------------------------- |
Sol Blast
Member #9,655
April 2008
|
I prefer the uniformity you get with the tab key (so in other words 4 in MVS6). |
ITAmember
Member #10,095
August 2008
|
I use soft indentation and 4 spaces because I'm a big python programmer and that is the python standard. But that's just me. |
Jeff Bernard
Member #6,698
December 2005
|
I typically use hard tabs. But if I ever use soft spacing (such as when formatting code for a forum), I use 3 spaces. -- |
CosmicR
Member #6,889
February 2006
|
I use whatever the source code formatter does in code::blocks. I think it's the K & R standard.
|
OnlineCop
Member #7,919
October 2006
|
I use tabs to indent, and spaces to align. My IDE usually have the tab/indentation level set to 3, since it's not as space-wasting as 4, and easier to read than 2. Although people who use tabs to indent also use tabs to align, I think it's a pain to visually match everything in their sources by either changing my IDE's tab/indentation level to match theirs or (in the extreme case) reformat their code to make everything align correctly. --|--|std::cout << "Text that is so long that it needs to break across lines " --|--| << "have the tabs set the same as the line above, and then hit " --|--| << "SPACE until the <<'s are aligned visually."; Now, whether I choose to have my tabs/indentation set at 3,4,8, or some other value, everything shifts by the same proportions and no reindentation is needed.
|
MiquelFire
Member #3,110
January 2003
|
I use tabs. Mainly so that if I edit the file in an editor that doesn't use Shift+Tab to deindent (or doesn't auto indent) I have less keys to type. --- |
CGamesPlay
Member #2,559
July 2002
|
Iusetabsbecausemykeyboarddoesn'thaveaspacebar. -- Ryan Patterson - <http://cgamesplay.com/> |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I use the tab key to put in spaces up to the next tab stop using Code Blocks. 3 space indentation is just about perfect. Not too much extra space on the left with large indentation levels, and enough space to see at a quick glance which blocks are where. I can't stand actual tabs though, because Code Blocks insists on displaying them as arrows, which makes any code with actual tabs in it look awful, at which point I immediately replace them with spaces. I may put in a request on the Code Blocks forums to have them allow invisible tabs as an option one of these days. What bugs me the most is when people use an 8 space tab with a different indentation level, so there's one tab and a space to meet up with the 3rd 3 space indentation. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
SiegeLord
Member #7,827
October 2006
|
Quote: I can't stand actual tabs though, because Code Blocks insists on displaying them as arrows Huh? Why don't you set the Settings->Editor->General Settings->Indent Options->Show Spaces to 'No'? "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Quote: Huh? Why don't you set the Settings->Editor->General Settings->Indent Options->Show Spaces to 'No'? Yikes! That made my code all floaty! I like having the dots indicate the spaces, but not the arrows indicating tabs. And besides, I didn't think that turning 'Show Spaces' off would turn off the tab characters as well. I learned something new. Thanks. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Evert
Member #794
November 2000
|
Soft tabs (in other words, tab inserts spaces), with a tabsize of 3. |
SiegeLord
Member #7,827
October 2006
|
Quote: I like having the dots indicate the spaces, but not the arrows indicating tabs Yeah, I guess they could have picked something less visually striking than an arrow... heh. As for the OP: I use tabs (tab size 4), because I like them. Also, makes keyboard navigation easier for me. I've yet to see an editor that will respect indentation when moving using the arrow keys unless you use tabs. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Mokkan
Member #4,355
February 2004
|
I use four spaces, no tabs. I can't stand tabs.
|
someone972
Member #7,719
August 2006
|
I use four soft spaces. This is either done by CB when I press tab or when I do it myself. I'm not sure which one I use more because I haven't been paying attention. ______________________________________ |
Neil Black
Member #7,867
October 2006
|
I use whatever the environment I'm in defaults to, because I'm too lazy to go in a change a setting that looks and works fine by default. I've used Dev-Cpp for years and I'm still not sure what the default setting is. If I had to pick a setting I'd go with four spaces.
|
Timorg
Member #2,028
March 2002
|
In Code::Blocks I used to use 4 spaces with a tab, and save them as a tab character, but I reinstalled at some point and forgot to change the setting. So I use 4 spaces, but use two for case labels and public/private/protected in classes. Eg.
____________________________________________________________________________________________ |
Trezker
Member #1,739
December 2001
|
I prefer tabs. But if I have to use spaces, 2 is enough. |
bamccaig
Member #7,536
July 2006
|
I use tabs to indent, but spaces to align (i.e., multiline statements that don't line up with tabs). My tab size is always 4. I find tabs more easy to work with, but spaces are needed to align continued lines where tabs don't necessarily line up perfectly. I find 4 spaces to be the most comfortable size. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Jonatan Hedborg
Member #4,886
July 2004
|
Always tabs. Spaces are evil. Tab size 2 or 3 is enough.
|
HardTranceFan
Member #7,317
June 2006
|
2 spaces. Any more and the nesting starts to slide off the side of the screen. -- |
Onewing
Member #6,152
August 2005
|
I use the '>' symbol as to know that I'm moving my characters to the right. Unfortunately, I had to build my own compiler to accomplish this. ------------ |
Steve++
Member #1,816
January 2002
|
Four spaces using hard tabs seems to be a common default for C-based languages. Why fight it? |
Jonatan Hedborg
Member #4,886
July 2004
|
Because if you use hard tabs you can fight it without anyone else noticing
|
Neil Walker
Member #210
April 2000
|
I really couldn't care less, I take whatever the default is for TAB, it's only spacing. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
|
|