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-studiohelpquestion
63 Posts 43 Posters 32 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.
  • K Kevin Marois

    Quick survey... How many of you uses tabs vs spaces to indent your code?

    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

    J Offline
    J Offline
    James Curran
    wrote on last edited by
    #48

    I use Tabs (as the Good Lord Intended)

    Truth, James

    1 Reply Last reply
    0
    • K Kevin Marois

      Quick survey... How many of you uses tabs vs spaces to indent your code?

      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #49

      I used tabs until Visual Studio .NET 2003 unrecoverably broke the block indent/undent operation when you mixed tabs and spaces. After that I switched to spaces. And yes, this same operation has been broken ever since. VC6 would let you have {tab}{tab}{sp}{sp}stuff, and when you indented, that became {tab}{tab}{tab}{sp}{sp}stuff. All versions since then have stripped the leading tabs and/or spaces and inserted N tabs or N*s spaces. Studio has been through more than one editor rewrite since then, and it still doesn't work right. I'm using VS2019 now, and it occasionally decides to treat indents as blocks. It's not predictable though.

      Software Zen: delete this;

      1 Reply Last reply
      0
      • M Mark Starr

        Indent? That’s really a thing? I just left-align everything. Tried right-align, but that was messy. :)

        Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel

        G Offline
        G Offline
        Gary R Wheeler
        wrote on last edited by
        #50

        Use RTL text (or even better bidi), I dare you.

        Software Zen: delete this;

        1 Reply Last reply
        0
        • P PIEBALDconsult

          No, TAB stops are by distance, not character count. A half inch is sufficient.

          O Offline
          O Offline
          ormonds
          wrote on last edited by
          #51

          Inches? I still use cubits.

          P 1 Reply Last reply
          0
          • O ormonds

            Inches? I still use cubits.

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #52

            So did Hitler.

            O 1 Reply Last reply
            0
            • K Kevin Marois

              Quick survey... How many of you uses tabs vs spaces to indent your code?

              If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

              D Offline
              D Offline
              Daniel Wilianto
              wrote on last edited by
              #53

              I always use IDE for coding. All IDEs that I use convert tab to spaces automatically. I always press TAB on keyboard when I want to indent, though. Since less keystroke is faster and better. So you could say that I am a TAB guy? But I am perfectly fine with it saved as spaces.

              1 Reply Last reply
              0
              • P PIEBALDconsult

                So did Hitler.

                O Offline
                O Offline
                ormonds
                wrote on last edited by
                #54

                You just reinforced Godwin's Law.

                1 Reply Last reply
                0
                • K Kevin Marois

                  Quick survey... How many of you uses tabs vs spaces to indent your code?

                  If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                  U Offline
                  U Offline
                  User 14060113
                  wrote on last edited by
                  #55

                  I use tabs bc using spaces is rude. For example, I personally prefer .html or .xaml files with an indentation of 3 spaces, for other file types I prefer 4 spaces. This is not possible if some ruthless predecessor inserted spaces according to his, probably different, personal preferences in the source files. Or if I am the predecessor, then I would force my 3 spaces upon other people. That's not the way to treat each other.

                  1 Reply Last reply
                  0
                  • K Kevin Marois

                    Quick survey... How many of you uses tabs vs spaces to indent your code?

                    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                    Y Offline
                    Y Offline
                    YSLGuru
                    wrote on last edited by
                    #56

                    Bad tabs, bad Tabs, whatcha gonna do, whatcha gonna do when they screw the code up for you?

                    1 Reply Last reply
                    0
                    • K Kevin Marois

                      Quick survey... How many of you uses tabs vs spaces to indent your code?

                      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                      Y Offline
                      Y Offline
                      YSLGuru
                      wrote on last edited by
                      #57

                      As a SQL dev it's SPACES all the way. I use a TAB to insert 2 spaces but never use the TAB character within my code.

                      1 Reply Last reply
                      0
                      • D David Crow

                        I use the TAB key to insert SPACES.

                        "One man's wage rise is another man's price increase." - Harold Wilson

                        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                        R Offline
                        R Offline
                        Roger House
                        wrote on last edited by
                        #58

                        Ditto

                        1 Reply Last reply
                        0
                        • K Kevin Marois

                          Quick survey... How many of you uses tabs vs spaces to indent your code?

                          If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                          S Offline
                          S Offline
                          Shmoken99
                          wrote on last edited by
                          #59

                          Is Spaces a slang term for Diet Coke? If so I definitely prefer it to Tab.

                          1 Reply Last reply
                          0
                          • Greg UtasG Greg Utas

                            I would've never thought there could be a good argument for tabs, but this sounds like a good way to satisfy everyone. My only question would be what the code looks like outside the IDE, in GitHub or even Notepad, for example.

                            Robust Services Core | Software Techniques for Lemmings | Articles
                            The fox knows many things, but the hedgehog knows one big thing.

                            D Offline
                            D Offline
                            DRHuff
                            wrote on last edited by
                            #60

                            No, no, no! If you think that you have found a good argument on the internet... :-D Thanks for the comment though. It is surprising the number of times I have brought this point up and people that were dead set against tabs get a surprised look on their faces. Never thought of that before. Every indentation is 1 tab - what you want it to look like is up to you. And if you use notepad to look at code - well I can't help everybody!

                            If you can't laugh at yourself - ask me and I will do it for you.

                            1 Reply Last reply
                            0
                            • O obermd

                              I think it had to do with what a mechanical typewriter was able to reliably insert. Remember, the tab key didn't shift x spaces, it shifted to the next tab stop, and yes, these were physical stops in a mechanical typewriter. Since these old machines worked on a fixed width font of 8 characters per inch and the physical tab stops were one inch apart, a tab became associated with 8 characters.

                              S Offline
                              S Offline
                              svella
                              wrote on last edited by
                              #61

                              Typewriters were typically either 10 (Pica) or 12 (Elite) characters per inch. Some of the later typewriters could support either and had swappable type balls.

                              1 Reply Last reply
                              0
                              • K Kevin Marois

                                Quick survey... How many of you uses tabs vs spaces to indent your code?

                                If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                                B Offline
                                B Offline
                                Br Bill
                                wrote on last edited by
                                #62

                                FINALLY someone has brought up this subject!

                                1 Reply Last reply
                                0
                                • K Kevin Marois

                                  Quick survey... How many of you uses tabs vs spaces to indent your code?

                                  If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                                  U Offline
                                  U Offline
                                  UziTech
                                  wrote on last edited by
                                  #63

                                  I think this thread nicely illustrates why tabs should be used for indentation. You want 2, 4, 8 character indentation, fine. You want half inch indentation, fine. You want 2½ character indentation, %#*$ you, but sure. No one has to choose what is the "right" amount, everyone's editor will display it how they want.

                                  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