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 54 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.
  • FreedMallocF FreedMalloc

    We all do. We all use one or the other, perhaps even both. :laugh: But to answer your question, I use spaces. I generally set up the IDE to sub 4 spaces for a tab.

    K Offline
    K Offline
    k5054
    wrote on last edited by
    #7

    FreedMalloc wrote:

    I generally set up the IDE to sub 4 spaces for a tab.

    Infidel! All right-minded people know that a tab stop is every 8 spaces! Anything else is heresy! Your immortal soul will be condemned to an eternity in an infinite loop unless you repent!

    Keep Calm and Carry On

    OriginalGriffO P L 3 Replies Last reply
    0
    • K k5054

      FreedMalloc wrote:

      I generally set up the IDE to sub 4 spaces for a tab.

      Infidel! All right-minded people know that a tab stop is every 8 spaces! Anything else is heresy! Your immortal soul will be condemned to an eternity in an infinite loop unless you repent!

      Keep Calm and Carry On

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #8

      Splitter! The Real Distance is obviously 3 spaces per tab.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      M W 2 Replies 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.

        Mike HankeyM Offline
        Mike HankeyM Offline
        Mike Hankey
        wrote on last edited by
        #9

        Beer cans used to have tabs...so I prefer tabs. :)

        PartsBin an Electronics Part Organizer - A updated version available! JaxCoder.com

        P M C 3 Replies Last reply
        0
        • Mike HankeyM Mike Hankey

          Beer cans used to have tabs...so I prefer tabs. :)

          PartsBin an Electronics Part Organizer - A updated version available! JaxCoder.com

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

          BUT BOTTLES USE ALL CAPS!!

          1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Splitter! The Real Distance is obviously 3 spaces per tab.

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #11

            Nah I like a tight real estate, 2 spaces per tab works best.

            Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

            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.

              F Offline
              F Offline
              Franc Morales
              wrote on last edited by
              #12

              Tabs because it is just one keypress.

              1 Reply Last reply
              0
              • K k5054

                FreedMalloc wrote:

                I generally set up the IDE to sub 4 spaces for a tab.

                Infidel! All right-minded people know that a tab stop is every 8 spaces! Anything else is heresy! Your immortal soul will be condemned to an eternity in an infinite loop unless you repent!

                Keep Calm and Carry On

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

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

                T O 2 Replies Last reply
                0
                • D DRHuff

                  I will answer the question you intended to ask. I use tabs. Set to 2 spaces as that is the indentation size I always use. I use the tabs because a lot of my coworkers use 4 spaces and they came just adjust the tab size to give the code the look they are used to.

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

                  Greg UtasG Offline
                  Greg UtasG Offline
                  Greg Utas
                  wrote on last edited by
                  #14

                  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.

                  <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                  <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                  K C D 3 Replies 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.

                    K Offline
                    K Offline
                    Kevin Marois
                    wrote on last edited by
                    #15

                    That's exaclty what drove me to ask. GitHub. PR's sometimes don't format correctly.

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

                    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.

                      R Offline
                      R Offline
                      Ravi Bhavnani
                      wrote on last edited by
                      #16

                      I use 1 tab = 4 spaces. /ravi

                      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                      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 13269747
                        wrote on last edited by
                        #17

                        I use whatever the project already uses. Some projects use tabs, some use spaces. When I start new projects, I use whatever the specific team[1] already uses - some teams have tabs set up as default in their IDE, some have spaces. In the rare occasion that I start a solo project with no team I tend to go with spaces. [1] I work across multiple teams.

                        1 Reply Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          Splitter! The Real Distance is obviously 3 spaces per tab.

                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                          W Offline
                          W Offline
                          Wizard of Sleeves
                          wrote on last edited by
                          #18

                          2½ spaces per tab

                          Nothing succeeds like a budgie without teeth. To err is human, to arr is pirate.

                          OriginalGriffO 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.

                            W Offline
                            W Offline
                            Wizard of Sleeves
                            wrote on last edited by
                            #19

                            I use the tab key, but my IDE converts them to spaces.

                            Nothing succeeds like a budgie without teeth. To err is human, to arr is pirate.

                            1 Reply Last reply
                            0
                            • K k5054

                              FreedMalloc wrote:

                              I generally set up the IDE to sub 4 spaces for a tab.

                              Infidel! All right-minded people know that a tab stop is every 8 spaces! Anything else is heresy! Your immortal soul will be condemned to an eternity in an infinite loop unless you repent!

                              Keep Calm and Carry On

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #20

                              I never understood that, 8 spaces per tab, on a teletype of all things - sheer lunacy.

                              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
                                den2k88
                                wrote on last edited by
                                #21

                                I prefer tabs because when I have to move code from an indentation level to another it requires less deletes. Also allows for fancy editing like a different character width for indentation than for code (it helps for people who have to set the font to 12pt with 125% or 150% magnification active, like yours truly). Also I have worked on a codebase modified by several people in several years with different tools and different indentations. Code was something like

                                if (condition){
                                code;
                                if (cnd2)
                                {
                                code;
                                }
                                code;
                                while(something)
                                {
                                code;
                                }
                                }

                                Tabs would have fixed the lunacy.

                                GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++*      Weapons extension: ma- k++ F+2 X

                                1 Reply Last reply
                                0
                                • W Wizard of Sleeves

                                  2½ spaces per tab

                                  Nothing succeeds like a budgie without teeth. To err is human, to arr is pirate.

                                  OriginalGriffO Offline
                                  OriginalGriffO Offline
                                  OriginalGriff
                                  wrote on last edited by
                                  #22

                                  :sigh: There's always someone who just wants to watch the world burn, isn't there? OK. You can have your half-a-space provided it's the top half.

                                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                                  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.

                                    A Offline
                                    A Offline
                                    acego
                                    wrote on last edited by
                                    #23

                                    I normally use Tab key (4 spaces) but it also depends on the IDE

                                    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.

                                      C Offline
                                      C Offline
                                      Cpichols
                                      wrote on last edited by
                                      #24

                                      I use a 2-space 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.

                                        C Offline
                                        C Offline
                                        Cpichols
                                        wrote on last edited by
                                        #25

                                        I only care about what it looks like to the one working on the code. When dealing with changes to legacy code, I follow the patter established, which usually means copy/paste of the disparate numbers of spaces depending on the mood of the coder when it was created in notepad :wtf: I really hate the ripple effect that gives - I mean choose an indentation style and stick with it. I'm happiest when working on fresh apps where I can use auto indenting on vscode. So much pleasanter and I can properly collapse the bits I don't need to see right now. Why would I screw that up with using spaces? Just no.

                                        Greg UtasG 1 Reply Last reply
                                        0
                                        • C Cpichols

                                          I only care about what it looks like to the one working on the code. When dealing with changes to legacy code, I follow the patter established, which usually means copy/paste of the disparate numbers of spaces depending on the mood of the coder when it was created in notepad :wtf: I really hate the ripple effect that gives - I mean choose an indentation style and stick with it. I'm happiest when working on fresh apps where I can use auto indenting on vscode. So much pleasanter and I can properly collapse the bits I don't need to see right now. Why would I screw that up with using spaces? Just no.

                                          Greg UtasG Offline
                                          Greg UtasG Offline
                                          Greg Utas
                                          wrote on last edited by
                                          #26

                                          What does using spaces have to do with collapsing code that you don't need to see right now?

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

                                          <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                                          <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                                          C 2 Replies 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