Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Tabs vs Spaces

Tabs vs Spaces

Scheduled Pinned Locked Moved The Lounge
visual-studioquestion
51 Posts 26 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J J Dunlap

    Sounds like a catch-22 to me. :( To each, his own choice (but then, of course, everyone gets the results of each other's choice as well as their own).

    "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
    "You must be the change you wish to see in the world." - Mahatma Gandhi

    T Offline
    T Offline
    Taka Muraoka
    wrote on last edited by
    #26

    jdunlap wrote: Sounds like a catch-22 to me. Not at all. If you always use spaces, everything will align correctly regardless of what anybody's tab settings are.


    Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

    J 1 Reply Last reply
    0
    • T Taka Muraoka

      jdunlap wrote: Sounds like a catch-22 to me. Not at all. If you always use spaces, everything will align correctly regardless of what anybody's tab settings are.


      Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

      J Offline
      J Offline
      J Dunlap
      wrote on last edited by
      #27

      :rose: I like my indenting to be more than one character width, and I don't want to have to go space-space-space-space for each indent. :rose: Things can get really messed up with spaces, as it takes so many spaces for an indent. Why not use spaces for comments, etc, and then tabs for other indents?

      "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
      "You must be the change you wish to see in the world." - Mahatma Gandhi

      T 1 Reply Last reply
      0
      • J J Dunlap

        :rose: I like my indenting to be more than one character width, and I don't want to have to go space-space-space-space for each indent. :rose: Things can get really messed up with spaces, as it takes so many spaces for an indent. Why not use spaces for comments, etc, and then tabs for other indents?

        "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
        "You must be the change you wish to see in the world." - Mahatma Gandhi

        T Offline
        T Offline
        Taka Muraoka
        wrote on last edited by
        #28

        jdunlap wrote: I don't want to have to go space-space-space-space for each indent. Virtually every editor on the planet has a switch to insert spaces instead of tabs. jdunlap wrote: Why not use spaces for comments, etc, and then tabs for other indents? Consistency. If you use one of the above-mentioned editors, then you don't have to remember anything.


        Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

        J D 2 Replies Last reply
        0
        • T Taka Muraoka

          jdunlap wrote: I don't want to have to go space-space-space-space for each indent. Virtually every editor on the planet has a switch to insert spaces instead of tabs. jdunlap wrote: Why not use spaces for comments, etc, and then tabs for other indents? Consistency. If you use one of the above-mentioned editors, then you don't have to remember anything.


          Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

          J Offline
          J Offline
          J Dunlap
          wrote on last edited by
          #29

          Ahh... You're right! I checked into it, and I've been using them all along - just used the tab key to indent. :-O :-O

          "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
          "You must be the change you wish to see in the world." - Mahatma Gandhi

          T 1 Reply Last reply
          0
          • J J Dunlap

            Ahh... You're right! I checked into it, and I've been using them all along - just used the tab key to indent. :-O :-O

            "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
            "You must be the change you wish to see in the world." - Mahatma Gandhi

            T Offline
            T Offline
            Taka Muraoka
            wrote on last edited by
            #30

            Good lad :-D ;P


            Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

            J 1 Reply Last reply
            0
            • T Taka Muraoka

              Good lad :-D ;P


              Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

              J Offline
              J Offline
              J Dunlap
              wrote on last edited by
              #31

              Taka Muraoka wrote: Good lad :laugh:

              "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
              "You must be the change you wish to see in the world." - Mahatma Gandhi

              1 Reply Last reply
              0
              • R Roger Wright

                l a u r e n wrote: people who use spaces should be shot I agree. I never use spaces. Or tabs. Or carriage returns, for that matter. Onelonglineofcodeafteranothershouldbeclearenoughforanyone;Thesemicolonsandcurlybracketsareeasyformachinestoreadanditdoesn'tmatterwhetherotherpeoplecanmakesenseofitwhenI'mdonebecauseit'salreadyperfectasitis.

                "Ask not for whom the bell tolls;
                It tolls for thee..."

                D Offline
                D Offline
                David Stone
                wrote on last edited by
                #32

                Amazingly I could read that... :omg:


                Hawaian shirts and shorts work too in Summer. People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage... -Anna-Jayne Metcalfe on Paintballing

                1 Reply Last reply
                0
                • S Shog9 0

                  ...and shoot everyone...

                  Shog9

                  So much he don't understand, Just might never make it to a man...

                  D Offline
                  D Offline
                  David Stone
                  wrote on last edited by
                  #33

                  But not me cuz I use \t :-D


                  Hawaian shirts and shorts work too in Summer. People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage... -Anna-Jayne Metcalfe on Paintballing

                  1 Reply Last reply
                  0
                  • R Roger Wright

                    l a u r e n wrote: people who use spaces should be shot I agree. I never use spaces. Or tabs. Or carriage returns, for that matter. Onelonglineofcodeafteranothershouldbeclearenoughforanyone;Thesemicolonsandcurlybracketsareeasyformachinestoreadanditdoesn'tmatterwhetherotherpeoplecanmakesenseofitwhenI'mdonebecauseit'salreadyperfectasitis.

                    "Ask not for whom the bell tolls;
                    It tolls for thee..."

                    C Offline
                    C Offline
                    Chris Austin
                    wrote on last edited by
                    #34

                    Roger Wright wrote: Onelonglineofcodeafteranothershouldbeclearenoughforanyone;Thesemicolonsandcurlybracketsareeasyformachinestoreadanditdoesn'tmatterwhetherotherpeoplecanmakesenseofitwhenI'mdonebecauseit'salreadyperfectasitis. OK! Who turned off the CP Perl Filter? :) Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that? - Jack Burton

                    1 Reply Last reply
                    0
                    • R Rein Hillmann

                      I know that this is quite a heated debate and I was always on the "Tabs forever" side of the argument but recently I've switched to spaces instead of tabs (due to factors outside of my control) and to be honest, I'm LOVING it. Now I can align all my code the way I like it and not have to worry about the tabs lining up with the parenthesis. What do you guys mostly use? Do your companies have a convention on this?

                      R Offline
                      R Offline
                      Robert Little
                      wrote on last edited by
                      #35

                      Spaces. That way I don't have to worry what editor is used, the code will always look the same. --

                      "The money power of the country will endeavor to prolong its rule by preying upon the prejudices of the people until all wealth is concentrated in a few hands and the Republic destroyed." -- Abraham Lincoln

                      A 1 Reply Last reply
                      0
                      • R Rein Hillmann

                        I know that this is quite a heated debate and I was always on the "Tabs forever" side of the argument but recently I've switched to spaces instead of tabs (due to factors outside of my control) and to be honest, I'm LOVING it. Now I can align all my code the way I like it and not have to worry about the tabs lining up with the parenthesis. What do you guys mostly use? Do your companies have a convention on this?

                        C Offline
                        C Offline
                        cmk
                        wrote on last edited by
                        #36

                        Geez, flashback to arguments 15yrs ago. At that time the consensus was tabs to the first character in a line, spaces after that. Not that that solves all the problems. Perhaps the argument should be turned from 'tabs vs. spaces', to 'people who don't use 4 spaces per tab stop should be shot'. Personally after having used both systems for years I now use the aforementioned tabs at the start, spaces within. With VS indent/unindent toolbar buttons I find tabs at the start much easier to live with. ...cmk

                        1 Reply Last reply
                        0
                        • R Rein Hillmann

                          I know that this is quite a heated debate and I was always on the "Tabs forever" side of the argument but recently I've switched to spaces instead of tabs (due to factors outside of my control) and to be honest, I'm LOVING it. Now I can align all my code the way I like it and not have to worry about the tabs lining up with the parenthesis. What do you guys mostly use? Do your companies have a convention on this?

                          L Offline
                          L Offline
                          LucidCoder
                          wrote on last edited by
                          #37

                          Spaces look great in that everything is layed out just the way the originator intended. The trouble is when you have to maintain a multitude of files that you didn't originally create and they all use a different number of spaces for indenting. You don't want to have to switch your editor's tabs/spaces. Tabs were invented for a reason. They abstractly represent an indentation without forcing a certain appearance on the viewer. Like HTML, beauty is in the eye of the beholder, not the creator. If someone wants to read their news in 16-pt Times Roman Font with double line spacing, they should be able to. Just the same, if someone wants to read your code in a manner that they are more accustomed to and is easier on their eyes, they should have a right. The chief complaint everyone has with tabs is that people mix tabs with spaces to line things up in their editor without realizing that it won't line up in someone else's. This is the true villain here. Whichever you choose, don't mix them up. I personally choose to line up my comments at a certain tab stop, though as there might still be conflicts when text runs past this point, I often don't line up my comments. I put them precisely two spaces after the code. However, on multi-line function headers, I do line up all the parameters on a common tab stop. E.g. void MyFunc1(int param1, int param2, int param3); void MyFunc2( int param1, int param2, int param3); void MyFunc3(int param1, int param2, int param3); Ironically, I had to use spaces to simulate tabs here. :laugh: The bottom line is that consistency is everything. If you use spaces, don't use tabs. If you use tabs, be careful with your spaces. After all, if it's not consistent, how can you call it a style?

                          1 Reply Last reply
                          0
                          • T Taka Muraoka

                            In a perfect world, that's perhaps what would happen. In practice, it never does. People often want to lay things out (e.g. in comments) but align on columns that are not at tabstops. So they type TAB TAB SPACE SPACE "xxx". Which ends up unreadable unless you have your tabstops set the same.


                            Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

                            F Offline
                            F Offline
                            Fredrik Skog
                            wrote on last edited by
                            #38

                            Taka Muraoka wrote: So they type TAB TAB SPACE SPACE "xxx". Doesn't this imply that people using spaces should be shot? ;P Cheers, Fredrik
                            "Felix qui potuit rerum cognoscere causas."

                            1 Reply Last reply
                            0
                            • R Rein Hillmann

                              I know that this is quite a heated debate and I was always on the "Tabs forever" side of the argument but recently I've switched to spaces instead of tabs (due to factors outside of my control) and to be honest, I'm LOVING it. Now I can align all my code the way I like it and not have to worry about the tabs lining up with the parenthesis. What do you guys mostly use? Do your companies have a convention on this?

                              J Offline
                              J Offline
                              Jim A Johnson
                              wrote on last edited by
                              #39

                              Tabs until the first non white char; spaces after that.

                              1 Reply Last reply
                              0
                              • R Rein Hillmann

                                I know that this is quite a heated debate and I was always on the "Tabs forever" side of the argument but recently I've switched to spaces instead of tabs (due to factors outside of my control) and to be honest, I'm LOVING it. Now I can align all my code the way I like it and not have to worry about the tabs lining up with the parenthesis. What do you guys mostly use? Do your companies have a convention on this?

                                P Offline
                                P Offline
                                peterchen
                                wrote on last edited by
                                #40

                                Spaces. I have an aligmnent fetisch.


                                "Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
                                sighist | Agile Programming | doxygen

                                1 Reply Last reply
                                0
                                • T Taka Muraoka

                                  jdunlap wrote: tell us why tabs are so bad. Have you ever had to work on source code written by somebody who had their tab stops set differently to you?


                                  Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

                                  S Offline
                                  S Offline
                                  Stephane Rodriguez
                                  wrote on last edited by
                                  #41

                                  Select text. Alt+F8. Done.

                                  1 Reply Last reply
                                  0
                                  • T Taka Muraoka

                                    People who use tabs should be shot!!!


                                    Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

                                    D Offline
                                    D Offline
                                    David Wulff
                                    wrote on last edited by
                                    #42

                                    The first thing I do when I open a code file that isn't mine is CTRL+A ALT+F8. And if that doesn't catch them all, a quick "Tabify selection" does the trick. :-D So when should I expect to see you?


                                    David Wulff

                                    "It is a helpless feeling to be unable to make something so terribly wrong... right."

                                    T 1 Reply Last reply
                                    0
                                    • T Taka Muraoka

                                      Don't sweat the petty stuff. Spaces vs. tabs is much more important :-|


                                      Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

                                      D Offline
                                      D Offline
                                      David Wulff
                                      wrote on last edited by
                                      #43

                                      Don't sweat the petty stuff and don't pet the sweaty stuff. What is Chris Meech that said that, it rings a bell? :)


                                      David Wulff

                                      "It is a helpless feeling to be unable to make something so terribly wrong... right."

                                      1 Reply Last reply
                                      0
                                      • T Taka Muraoka

                                        jdunlap wrote: I don't want to have to go space-space-space-space for each indent. Virtually every editor on the planet has a switch to insert spaces instead of tabs. jdunlap wrote: Why not use spaces for comments, etc, and then tabs for other indents? Consistency. If you use one of the above-mentioned editors, then you don't have to remember anything.


                                        Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

                                        D Offline
                                        D Offline
                                        David Wulff
                                        wrote on last edited by
                                        #44

                                        Taka Muraoka wrote: Virtually every editor on the planet has a switch to insert spaces instead of tabs Yes, but what about backspacing? :rolleyes:


                                        David Wulff

                                        "It is a helpless feeling to be unable to make something so terribly wrong... right."

                                        1 Reply Last reply
                                        0
                                        • D David Wulff

                                          The first thing I do when I open a code file that isn't mine is CTRL+A ALT+F8. And if that doesn't catch them all, a quick "Tabify selection" does the trick. :-D So when should I expect to see you?


                                          David Wulff

                                          "It is a helpless feeling to be unable to make something so terribly wrong... right."

                                          T Offline
                                          T Offline
                                          Taka Muraoka
                                          wrote on last edited by
                                          #45

                                          David Wulff wrote: The first thing I do when I open a code file that isn't mine is CTRL+A ALT+F8. S.Rod suggested the same thing but this is not the answer. 1) Not everyone uses Visual Studio. I ran into this problem the most when I was working under UNIX. 2) Checking such a file back into source control is a real PITA because it becomes really hard to tell what is a legitimate change and what is tab-fixing. David Wulff wrote: So when should I expect to see you? Any time. Any place. :-|


                                          Software is everything. It also sucks. Charles Fishman [^] Awasu 1.0.4 (beta)[^]: A free RSS reader with support for Code Project.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups