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 56 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.
  • L Lost User

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

    O Offline
    O Offline
    obermd
    wrote on last edited by
    #37

    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 1 Reply 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

      M Offline
      M Offline
      megaadam
      wrote on last edited by
      #38

      I fine with that as long as you pick up the tab!

      "If we don't change direction, we'll end up where we're going"

      Mike HankeyM 1 Reply Last reply
      0
      • M megaadam

        I fine with that as long as you pick up the tab!

        "If we don't change direction, we'll end up where we're going"

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

        Not any more Tab Soda 12 Pack Soft Drinks Tab Soda Discontinued 🥤02/2021 | eBay[^]

        PartsBin an Electronics Part Organizer - A updated version available! JaxCoder.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.

          T Offline
          T Offline
          TNCaver
          wrote on last edited by
          #40

          Tabs. Converting the tabs to spaces in my code is a capital offense with immediate execution of the sentence.

          If you think 'goto' is evil, try writing an Assembly program without JMP.

          1 Reply 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

            C Offline
            C Offline
            Choroid
            wrote on last edited by
            #41

            Competition for your "PartsBin" Wait... What? I Made a Small Parts Organizer with Drawers from Cardboard! - YouTube[^] Perhaps include this as an add on

            Mike HankeyM 1 Reply Last reply
            0
            • C Choroid

              Competition for your "PartsBin" Wait... What? I Made a Small Parts Organizer with Drawers from Cardboard! - YouTube[^] Perhaps include this as an add on

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

              Awesome thanks for the link. Good storage alternative, especially since the organizers are so dang expensive.

              PartsBin an Electronics Part Organizer - A updated version available! JaxCoder.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.

                M Offline
                M Offline
                Member_15777962
                wrote on last edited by
                #43

                I use Tabs for Columns, and spaces for strings, Carriage Return/Line Feed for new Row. Makes sense when Using Excel. For notepad it doesn't matter :-)

                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.

                  J Offline
                  J Offline
                  Jim Spencer100
                  wrote on last edited by
                  #44

                  If(spaceToAdd > 1) { Tab(); } else { Space(); } // This is how my brain does it :P

                  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.

                    E Offline
                    E Offline
                    englebart
                    wrote on last edited by
                    #45

                    I prefer tabs. Our code size in bytes could double or quadruple or ? based on how many spaces were substituted. A lot of lines in brace delimited languages are 8 tabs, open or close brace. Python, stick to spaces!

                    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
                      StatementTerminator
                      wrote on last edited by
                      #46

                      I use tab and shift+tab in VS to keep things in neat code blocks. I don't really care how many spaces a tab is as long as it's consistent (I use the default). I've never seen a good reason to use spaces, whenever I see code like that it's usually a mess. It's possible to format code well using spaces, but that's not what I usually see in the wild.

                      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.

                        J Offline
                        J Offline
                        Juan Pablo Reyes Altamirano
                        wrote on last edited by
                        #47

                        If it doesn't auto-indent, I will tab. But now I wonder if K&R C had anything to say about that :~

                        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.

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