![]() |
| |||||||
| View Poll Results: How do you indent? | |||
| Tabs | | 19 | 55.88% |
| 1 space per level | | 0 | 0% |
| 2 or 3 spaces per level | | 6 | 17.65% |
| 4 through 6 spaces per level | | 7 | 20.59% |
| 7+ spaces per level | | 2 | 5.88% |
| Voters: 34. You may not vote on this poll | |||
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #16 |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,754
| For non-work, I indent with 4 spaces. I don't really have a strong feeling about it, but what I do hate are source files that have been mangled up with a mixture of tabs and spaces.
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot |
| brewbuck is offline | |
| | #17 |
| Robot Join Date: Mar 2009
Posts: 258
| I like tabs and always keep my code 80 characters wide at most. Only one problem though: Let's say your company has a rule that code should not be more than 80 characters wide, and you start using tabs that are only 4 characters wide. What happens when someone who likes their tabs to be 8 characters wide opens your file and find that every other line soft wraps or disappears into the marginal? |
| Memloop is offline | |
| | #18 | |
| & the hat of GPL slaying Join Date: Sep 2001
Posts: 5,732
| Quote:
I personally use tabs as it makes doing find/replace regex a lot easier, plus hitting the tab key is easier than hitting the space bar a bunch of times. Though with a good text editor you don't have to worry so much about that as it takes care of it for ya. | |
| Thantos is offline | |
| | #19 | |
| Guest Join Date: Aug 2001
Posts: 5,018
| Quote:
| |
| Sebastiani is offline | |
| | #20 |
| Code Goddess Join Date: Sep 2001
Posts: 9,664
| >It would allow us to see how everyone slowly trends from their >imperfect indentation style, to the correct style of 4 spaces over time Heheh. >I was just wondering: how do you indent your source code? I prefer two spaces, but any even number is comfortable. Odd numbers are unnatural.
__________________ My best code is written with the delete key. |
| Prelude is offline | |
| | #21 |
| Registered User Join Date: Dec 2006 Location: Canada
Posts: 2,001
| I use 8 spaces (set my editor to convert tabs to spaces). No particular reason. |
| cyberfish is offline | |
| | #22 |
| (?<!re)tired Join Date: May 2006 Location: Portugal
Posts: 5,611
| This pool has become a revelation to me. I was pretty sure until now very few people used ASCII(9) for their code indenting. And I certainly haven't been seeing much of that when looking at code online or when copy pasting it to my editor from many different sources. My guess... this pool is fixed! tabs are evil.
__________________ Originally Posted by brewbuck: Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster. |
| Mario F. is offline | |
| | #23 |
| l'Anziano Join Date: Aug 2001
Posts: 2,616
| I most definitely use ASCII(9), a.k.a. '\t'. It's the best way to go to keep things properly aligned, in my opinion. I hate it when I edit code that uses spaces and I have to backspace a million times to delete an indentation instead of simply backspacing once. |
| DavidP is offline | |
| | #24 | |
| C++ Witch Join Date: Oct 2003 Location: Singapore
Posts: 11,263
| Quote:
Anyway, I note that this thread is about the amount by which one indents, not about whether one indents with space characters or tab characters.
__________________ C + C++ Compiler: MinGW port of GCC Build + Version Control System: SCons + Bazaar Look up a C/C++ Reference and learn How To Ask Questions The Smart Way | |
| laserlight is offline | |
| | #25 | |
| Registered User Join Date: Sep 2004 Location: California
Posts: 3,020
| Quote:
:set tabstop=4 :set shiftwidth=4 :set expandtab :set softtabstop=4 With these settings, you don't even know you are using spaces instead of tabs. The tab key, delete key, and formatting behave exactly as you would expect. Plus you get the added benefit of consistent formatting since you are actually using spaces instead of tabs. There is probably equivalent settings in other editors, but why would anyone ever want to use a different editor?
__________________ bit∙hub [bit-huhb] n. A source and destination for information. | |
| bithub is offline | |
| | #26 |
| Code Goddess Join Date: Sep 2001
Posts: 9,664
| >I note that this thread is about the amount by which one indents, not >about whether one indents with space characters or tab characters. The amount is far more interesting. But I use real spaces because the amount is small enough that there's really no difference between tabbing once and spacing twice. If I used an indent of four or more spaces, I would be more inclined to switch to tabs.
__________________ My best code is written with the delete key. |
| Prelude is offline | |
| | #27 |
| Robot Join Date: Mar 2009
Posts: 258
| |
| Memloop is offline | |
| | #28 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,767
| Me, I like tabs. Usually I think that 4 spaces is an ideal indentation level, and it is the default of Visual Studio, so that is what I use.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #29 | |
| C++ Witch Join Date: Oct 2003 Location: Singapore
Posts: 11,263
| Quote:
__________________ C + C++ Compiler: MinGW port of GCC Build + Version Control System: SCons + Bazaar Look up a C/C++ Reference and learn How To Ask Questions The Smart Way | |
| laserlight is offline | |
| | #30 | |
| Guest Join Date: Aug 2001
Posts: 5,018
| Quote: | |
| Sebastiani is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Changing 3 spaces to tabs | dnguyen1022 | C Programming | 2 | 12-22-2008 12:51 AM |
| Tabs or Spaces | DavidP | General Discussions | 46 | 04-08-2007 11:45 AM |
| Visual C++ | Golffor1 | C++ Programming | 1 | 08-04-2003 04:30 PM |
| tabs to spaces with dev c++ v.4 | stallion | Windows Programming | 2 | 01-28-2003 02:07 PM |
| Tab Controls - API | -KEN- | Windows Programming | 7 | 06-02-2002 09:44 AM |