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. Indenting: spaces or tabs?

Indenting: spaces or tabs?

Scheduled Pinned Locked Moved The Lounge
visual-studiocomquestion
39 Posts 25 Posters 4 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 Luca Leonardo Scorcia

    A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

    M Offline
    M Offline
    Michael P Butler
    wrote on last edited by
    #6

    How to start a religious war in one easy post :-D LOL Personally I've used tabs since I started in C back in 1989. I have my tab set at 4. The code is readable, which is the most important thing. Michael Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.

    S 1 Reply Last reply
    0
    • L Luca Leonardo Scorcia

      A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

      _ Offline
      _ Offline
      _Magnus_
      wrote on last edited by
      #7

      I want to use tabs but have to use spaces, and it sucks.. X| With tabs everybody can have the tabwidth they want. If you want to delete the tab you just type you only have to press backspace once. Easier to reformat the code. I cant see a single advantage with using spaces. /Magnus


      - I don't necessarily agree with everything I say

      V T 2 Replies Last reply
      0
      • L Luca Leonardo Scorcia

        A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

        D Offline
        D Offline
        Daniel Turini
        wrote on last edited by
        #8

        If you are worried about tabs and spaces you're using the wrong set of programming tools... :zzz: :zzz: :zzz: Concussus surgo. When struck I rise.

        L P 2 Replies Last reply
        0
        • _ _Magnus_

          I want to use tabs but have to use spaces, and it sucks.. X| With tabs everybody can have the tabwidth they want. If you want to delete the tab you just type you only have to press backspace once. Easier to reformat the code. I cant see a single advantage with using spaces. /Magnus


          - I don't necessarily agree with everything I say

          V Offline
          V Offline
          Vagif Abilov
          wrote on last edited by
          #9

          _Magnus_ wrote: With tabs everybody can have the tabwidth they want. If you want to delete the tab you just type you only have to press backspace once. Easier to reformat the code. Fully agree. This the main reason I use tabs: everybody can have the tabwidth they want, without reformatting the code. Take a team of 3 space lovers: they all ident text with different number of spaces. This is why spacers suck and tabers rule! ;) Vagif Abilov MCP (Visual C++) Oslo, Norway Hex is for sissies. Real men use binary. And the most hardcore types use only zeros - uppercase zeros and lowercase zeros. Tomasz Sowinski

          1 Reply Last reply
          0
          • D Daniel Turini

            If you are worried about tabs and spaces you're using the wrong set of programming tools... :zzz: :zzz: :zzz: Concussus surgo. When struck I rise.

            L Offline
            L Offline
            Luca Leonardo Scorcia
            wrote on last edited by
            #10

            I'm using VS.NET for heavy editing and notepad... for everything else :) Actually it's not when using a single program that I notice the difference, but when I have to use different editors. If only notepad had the Tab Size option... BTW, which programming tools are you using? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

            M D D 3 Replies Last reply
            0
            • L Luca Leonardo Scorcia

              A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

              S Offline
              S Offline
              Simon Walton
              wrote on last edited by
              #11

              Tabs, without a doubt. I can't understand why you would use spaces when you can set the editor to indent tabs by x for you.

              8

              SIMON WALTON
              SONORK ID 100.10024

              P 1 Reply Last reply
              0
              • L Luca Leonardo Scorcia

                A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

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

                Tabs, set to 4 spaces :) Elaine (fluffy tigress emoticon) Would you like to meet my teddy bear ?

                J 1 Reply Last reply
                0
                • L Luca Leonardo Scorcia

                  A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

                  M Offline
                  M Offline
                  Megan Forbes
                  wrote on last edited by
                  #13

                  tabs set to 4 spaces. If you need to use notepad for any unfortunate reason, it is better to go to DOS and use it's editor - you can set tabs in that too The following statement about your geekness is true. The previous statement about your geekness is not true. GCS/IT/P d- s: a- C++++$ UL+>++++ P+ L++$ E- W+++$ N !o K+ w++$ O---- M-- PS- PE Y+ PGP--- t !5 X- tv b+++ DI++ D+ G++ e++ h--- r+++

                  1 Reply Last reply
                  0
                  • L Luca Leonardo Scorcia

                    I'm using VS.NET for heavy editing and notepad... for everything else :) Actually it's not when using a single program that I notice the difference, but when I have to use different editors. If only notepad had the Tab Size option... BTW, which programming tools are you using? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

                    M Offline
                    M Offline
                    Megan Forbes
                    wrote on last edited by
                    #14

                    Use the DOS editor...;P The following statement about your geekness is true. The previous statement about your geekness is not true. GCS/IT/P d- s: a- C++++$ UL+>++++ P+ L++$ E- W+++$ N !o K+ w++$ O---- M-- PS- PE Y+ PGP--- t !5 X- tv b+++ DI++ D+ G++ e++ h--- r+++

                    G 1 Reply Last reply
                    0
                    • M Michael P Butler

                      How to start a religious war in one easy post :-D LOL Personally I've used tabs since I started in C back in 1989. I have my tab set at 4. The code is readable, which is the most important thing. Michael Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.

                      S Offline
                      S Offline
                      Sijin
                      wrote on last edited by
                      #15

                      Michael P Butler wrote: I have my tab set at 4. Me 2 :) :) May the Source be with you Sonork ID 100.9997 sijinjoseph

                      1 Reply Last reply
                      0
                      • L Luca Leonardo Scorcia

                        I'm using VS.NET for heavy editing and notepad... for everything else :) Actually it's not when using a single program that I notice the difference, but when I have to use different editors. If only notepad had the Tab Size option... BTW, which programming tools are you using? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

                        D Offline
                        D Offline
                        Dan Morris
                        wrote on last edited by
                        #16

                        Luca Leonardo Scorcia wrote: If only notepad had the Tab Size option... I use a cool little tool "TextPad" (I'm sure there are others like it) that is a suped-up version of Notepad. You can set tabs to whatever you'd like. I use it to quickly view files without having to open any IDE's. And it has support for syntax coloring for various languages etc. Check it out: http://www.textpad.com [^] Dan Morris _____________________________________ "An eye for an eye makes the whole world blind." - Ghandi

                        1 Reply Last reply
                        0
                        • L Luca Leonardo Scorcia

                          A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

                          V Offline
                          V Offline
                          Vuemme
                          wrote on last edited by
                          #17

                          Tabs set to 4 spaces. And I usually ident code with open and close braces on a separate row: ex: if () { } else { } Here you'll find some code idented in a funny way :) P.S. In some languages (python, for example) identing is mandatory. -- Looking for a new screen-saver? Try FOYD: http://digilander.iol.it/FOYD

                          S 1 Reply Last reply
                          0
                          • L Lost User

                            Tabs, set to 4 spaces :) Elaine (fluffy tigress emoticon) Would you like to meet my teddy bear ?

                            J Offline
                            J Offline
                            Jason Hooper
                            wrote on last edited by
                            #18

                            Ditto... in vi, notepad, vc++, etc. - Jason (SonorkID 100.611) The Code Project - Orange makes the art grow fonder

                            W 1 Reply Last reply
                            0
                            • L Luca Leonardo Scorcia

                              I'm using VS.NET for heavy editing and notepad... for everything else :) Actually it's not when using a single program that I notice the difference, but when I have to use different editors. If only notepad had the Tab Size option... BTW, which programming tools are you using? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

                              D Offline
                              D Offline
                              Daniel Turini
                              wrote on last edited by
                              #19

                              I mainly use VS.NET and UltraEdit. UltraEdit is the one of the best text editors I've seen to date. Highly configurable, but the default configuration rocks! The other editor which brings me good memories is Boxer (for DOS, unfortunately - the Windows version sucks). Concussus surgo. When struck I rise.

                              1 Reply Last reply
                              0
                              • J Jason Hooper

                                Ditto... in vi, notepad, vc++, etc. - Jason (SonorkID 100.611) The Code Project - Orange makes the art grow fonder

                                W Offline
                                W Offline
                                Wouter Dhondt
                                wrote on last edited by
                                #20

                                Ahhh, vi. Man's favourite editor. Or: how to make something incredibly difficult, which could be made very easy so that only true geeks can use it... New and improved: kwakkelflap.com "When I hear of Schrödinger's cat, I reach for my gun." - Stephen Hawking

                                1 Reply Last reply
                                0
                                • M Megan Forbes

                                  Use the DOS editor...;P The following statement about your geekness is true. The previous statement about your geekness is not true. GCS/IT/P d- s: a- C++++$ UL+>++++ P+ L++$ E- W+++$ N !o K+ w++$ O---- M-- PS- PE Y+ PGP--- t !5 X- tv b+++ DI++ D+ G++ e++ h--- r+++

                                  G Offline
                                  G Offline
                                  Gary Wheeler
                                  wrote on last edited by
                                  #21

                                  Real programmers use EDLIN. (although the best programmer's editor was TECO on the DEC PDP-11 under RT-11)


                                  "Think of it as evolution in action." - 'Oath of Fealty' by Larry Niven and Jerry Pournelle

                                  P B 2 Replies Last reply
                                  0
                                  • L Luca Leonardo Scorcia

                                    A little survey about your code-indent style... what do you use? Spaces or tabs? I used to do a mix of tabs and spaces, but the code looked awful when edited with VS and then opened with notepad for a quick look. So I started using only spaces, but I noticed that for some files indentation made the file size grow a lot... now I'm using only tabs. I think that's the best way: any serious code editor can set the tab size to any number of space you want, code in notepad looks fine, and it's faster to type and files don't get too large. These are my 2 cents. And yours? Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)

                                    T Offline
                                    T Offline
                                    Tomas Petricek
                                    wrote on last edited by
                                    #22

                                    2 spaces !!

                                    1 Reply Last reply
                                    0
                                    • S Simon Walton

                                      Tabs, without a doubt. I can't understand why you would use spaces when you can set the editor to indent tabs by x for you.

                                      8

                                      SIMON WALTON
                                      SONORK ID 100.10024

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

                                      Depends on your alignment preferences, and the TAB's other people use: if you always only care about left indentation, it's almost no problem. however, for thing like

                                      case eOphelia: // is it her?
                                      if (act.inRiver) // yes ==> dead already?
                                      act.dead = true; // yes ==> force dead
                                      // (simon always forgets to update flags)

                                      now look at it on a system with a different TAB width...


                                      Auch den Schatten will ich lieben weil ich manchmal lieber frier'  Rosenstolz   [sighist]

                                      1 Reply Last reply
                                      0
                                      • V Vuemme

                                        Tabs set to 4 spaces. And I usually ident code with open and close braces on a separate row: ex: if () { } else { } Here you'll find some code idented in a funny way :) P.S. In some languages (python, for example) identing is mandatory. -- Looking for a new screen-saver? Try FOYD: http://digilander.iol.it/FOYD

                                        S Offline
                                        S Offline
                                        Simon Walton
                                        wrote on last edited by
                                        #24

                                        Welcome to your new job, Mr Walton. There's a serious stack overflow bug in this code, we'll need you to solve it by, oh, noon. Or you're fired.

                                        8

                                        SIMON WALTON
                                        SONORK ID 100.10024

                                        1 Reply Last reply
                                        0
                                        • G Gary Wheeler

                                          Real programmers use EDLIN. (although the best programmer's editor was TECO on the DEC PDP-11 under RT-11)


                                          "Think of it as evolution in action." - 'Oath of Fealty' by Larry Niven and Jerry Pournelle

                                          P Offline
                                          P Offline
                                          Paul Riley
                                          wrote on last edited by
                                          #25

                                          I quite liked "vi". I know I tend towards the "why do things the hard way when there's lovely tool to do it for you?" school of thought but vi was incredibly easy once you'd been using it for a while. Most of the commands were instinctive (but it was always helpful to have a quick reference guide around, just in case) just like anything else after using it constantly for a few weeks. Paul

                                          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