View Poll Results: How many spaces do you indent your code?

Voters
68. You may not vote on this poll
  • 1 space

    4 5.88%
  • 2 spaces

    21 30.88%
  • 3 spaces

    13 19.12%
  • 4 spaces

    33 48.53%
  • 5 spaces

    7 10.29%
  • 6 spaces

    5 7.35%
  • 7 spaces

    4 5.88%
  • 8 spaces

    8 11.76%
  • Other

    7 10.29%
Multiple Choice Poll.

How far do you indent?

This is a discussion on How far do you indent? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I use a varying number of spaces depending on the language I'm working with...php my spacing is very sporadic because ...

  1. #31
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    I use a varying number of spaces depending on the language I'm working with...php my spacing is very sporadic because my editor replaces all tabs with spaces automatically so it's hard to have some uniform spacing thing going on (as the auto-tab-indentation-selector-thing isn't very good, it'll randomly indent 2 spaces, or maybe 4, or maybe 7).

    C++, however, I use 4 all the time, just seems like a decent in-between as I don't think 2 would make the code incredibly readable but 6 or 8 would make the code harder to read. In the end, I doubt I'll run out of hard drive space by using 4 spaces to indent as opposed to 2 or 1, heh, these days you can buy a gig of hard drive space for $1.

  2. #32
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    I start at left margin and add 2 per level of indentation.

    I've never needed to go deeper than 6 that way.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  3. #33
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    I use tabs where each tab is 5 spaces. Never noticed the problem like drks posted example.

  4. #34
    Registered User
    Join Date
    Aug 2005
    Posts
    96
    I use 4 spaces. In Code:Blocks a Tab is 4 spaces so I use that too.

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Weird Strings??
    By Paul22000 in forum C++ Programming
    Replies: 12
    Last Post: 07-14-2008, 01:02 PM
  2. array comparison
    By battoujutsu in forum C Programming
    Replies: 12
    Last Post: 12-05-2003, 10:47 AM
  3. Visual C++
    By Golffor1 in forum C++ Programming
    Replies: 1
    Last Post: 08-04-2003, 04:30 PM
  4. how to indent a file.
    By hakim12 in forum C++ Programming
    Replies: 2
    Last Post: 01-30-2003, 01:55 PM
  5. Indent code
    By boontune in forum C++ Programming
    Replies: 3
    Last Post: 01-23-2003, 10:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21