View Poll Results: To TAB or not to TAB (Code Indentation)

Voters
44. You may not vote on this poll
  • Use Tabs

    25 56.82%
  • Use Spaces

    19 43.18%

To TAB or not to TAB...

This is a discussion on To TAB or not to TAB... within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I use 5 space tabs. Dunno why. I guess I'm just lazy....

  1. #31
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942
    I use 5 space tabs. Dunno why. I guess I'm just lazy.

  2. #32
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Originally posted by Thantos
    IIRC tabs are actually 5 characters, its been that way since the days of typewriters. Set your word processor to a fixed width font and try it out. Its 5 characters.
    No, it's not. The number of characters used depends on what font size you're using. At least that's the case in Word 2002.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #33
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    And as for tab sizes, the standard is 8 spaces, nothing else.
    In some programming languages this is part of the language definition (Python and Haskell for example).
    I use a tabstop of four spaces though.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #34
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    Spaces all the way! Two spaces all the way!

    Code:
    #include <iostream>
    
    int main( void )
    {
      std :: cout << "Hello World!" << std :: endl;
      return 0;
    }
    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  5. #35
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Am I the only one who uses three space tabs then? I think 3 is perfect for readability.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  6. #36
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    Originally posted by Speedy5
    Three spaces with the tab-to-space feature (which also allows shift-tab).
    Leeme quote myself.

    3 is perfect as it is in many other cases

  7. #37
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    i have tab set to four spaces becuase of cout... example:
    Code:
    cout<<"blah blah blah blah"<<endl
        <<"second line blah blah blah"<<endl;
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  8. #38
    Banned
    Join Date
    Dec 2003
    Posts
    367
    When I first saw the post I was excited, thinking it was a music discussion. I do have to say I am disappointed!

  9. #39
    Deleted Account
    Join Date
    Jan 2004
    Posts
    40
    Originally posted by SirCrono6
    Spaces all the way! Two spaces all the way!

    Code:
    #include <iostream>
    
    int main( void )
    {
      std :: cout << "Hello World!" << std :: endl;
      return 0;
    }
    - SirCrono6
    There is no reason to use int main(void) in c++
    int main() is exactly the same.

  10. #40
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Originally posted by Brian2
    There is no reason to use int main(void) in c++
    int main() is exactly the same.
    Then why waste the time to question it?
    Do not make direct eye contact with me.

  11. #41
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    Yeah, I know. I don't normally use it anyway .

    Code:
    int main(int argc, char *argv[])
    All the way!

    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  12. #42
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    There is no reason to use int main(void) in c++
    int main() is exactly the same.
    Brian2 would you please stop posting crap. Thank you
    http://faq.cprogramming.com/cgi-bin/...&id=1043284376

  13. #43
    Registered User Grayson_Peddie's Avatar
    Join Date
    May 2002
    Posts
    96

    Although I do use tab...

    ...I have Visual C# .net set to 4 spaces and I use Virtual Spaces because if I'm going to be posting a code in the forum, Visual C# .net converts from tabs to spaces. I also use tabs to line up the code. For example:

    Code:
    using System;
    using System.Drawing;
    using System.Windows.Forms;
    
    namespace Example
    {
        /// <summary>
        /// Main class for the form
        /// </summary>
        public class Form1 : System.Windows.Forms.Form
        {
            /// <summary>
            /// Constructor for a Windows Form class
            /// </summary>
            public Form1()
            {
                InitializeComponents()
            }
            
            /// <summary>
            /// Used for initializing a form and all the controls needed
            /// for the application.
            /// </summary>
            public void InitializeComponents()
            {
                //
                // form1
                //
                this.Text            = "Form 1 Example";
                this.BackColor       = System.Drawing.Color.Black;
                // ...
            }
            
            /// <summary>
            /// Entry point for starting an application.
            /// </summary>
            public static void Main(string[] args)
            {
                Application.Run(form1);
            }
        }
    }
    Last edited by Grayson_Peddie; 01-10-2004 at 01:34 PM.
    View in Braille.
    http://www.future-gpnet.com/braille.jpg

    Like a bolt out of the BLUE,
    Fate steps up and sees you THROUGH,
    When you wish upon a STAR
    YOUR DREAMS COME TRUE.

  14. #44
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    many editors treat tabs and spaces the same way. E.g. if you have 4 spaces and press backspace they all get deleted. If you have 1 one tab and set it to be the size of 4 spaces then it will do the samething. The only difrence is that with spaces you can click everywhere and the caret will be positioned there but with tabs it will be positioned to the begining or end of the tab. Some people (like me) are just to lazy to change the setting becuase of this.

  15. #45
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    The number of characters used depends on what font size you're using
    Yeah after looking at it some more I realize its actually going to the same spot of the paper.

    But if you do put in to Courier New 12pt which is the closest to the typeface that most typewriters used it is 5 spaces which is actually what my point was about

    I think most of us use spaces regardless (or should it be irregardless?) if we get them by hitting the spacebar or having tabs set to insert spaces instead of the tab character.

Page 3 of 4 FirstFirst 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tab Ordering of GUI Controls
    By cloudy in forum Windows Programming
    Replies: 2
    Last Post: 04-22-2006, 10:13 AM
  2. Tab order in Tab Control
    By Halloko in forum Windows Programming
    Replies: 2
    Last Post: 05-09-2005, 12:08 AM
  3. Visual C++
    By Golffor1 in forum C++ Programming
    Replies: 1
    Last Post: 08-04-2003, 05:30 PM
  4. Disable a tab in control tab?
    By Iron Mike in forum Windows Programming
    Replies: 1
    Last Post: 07-23-2003, 11:50 AM
  5. Tab controls - MFC (revived)
    By Robert602 in forum Windows Programming
    Replies: 1
    Last Post: 01-22-2002, 12:32 PM

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