View Poll Results: Do you like editors that default to tabs or to spaces?

Voters
40. You may not vote on this poll
  • Go tabs!

    18 45.00%
  • Go spaces!

    22 55.00%

Tabs or Spaces

This is a discussion on Tabs or Spaces within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Spaces are universal and every editor should know what spaces are and how many to use. Tabs are relative to ...

  1. #31
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    Spaces are universal and every editor should know what spaces are and how many to use. Tabs are relative to the app and settings in the editor displaying the document.
    I would say it is the complete opposite. Tabs are universal. Any editor can read a tab, and know that there should be some amount of specified indentation.

    NOT all editors agree on what spaces are and how many to use, and that is exactly the problem. Tabs are NOT relative, but are universal. Spaces are relative to the editor.

    Hence the options that occur in most editors: "Spaces per tab indentation"....because each editor does it differently.

    [edit]
    Oh...and I have never experienced the board messing up tabs. The python code I posted earlier used tabs...looks great to me.
    [/edit]

    [edit #2]

    I would have to agree with laserlight that for the most part it is the mixture of tabs and spaces that really obfuscates code. Tabs and spaces simply dont go together. If yall want to use spaces, then that is your choice, but I would have to agree that a mixture of the two just doesnt work.

    But when it comes down to choosing either spaces or tabs, it's tabs all the way.
    [/edit]
    Last edited by DavidP; 04-06-2007 at 01:32 AM.
    My Website

    "Circular logic is good because it is."

  2. #32
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444
    On the contrary ... a space has a fixed width of "space" while a tab has a relative width. Just like in Word you can chose your own tab width. 4 spaces will always look the same, regardless of what editor you use, since it depends only on the font size. Tabs on the contrary depends on your application.

  3. #33
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    It really depends on who is going to see it really, doesn't it? I mean, for c-prog it's good to have four (etc), spaces cause it doesn't change the code to being "uber spaced", I think ethic has a problem with that, so I'm going to say he likes spaces too. However, if you're just writing code for yourself I don't think it matters what you use, I'd wager that whatever your IDE came defaulted to is what you love most. Alternatively if you're writing code for the "man" it's whatever he wants that you're going to use regardless of which you prefer.

    It took me a while to realise the importance of code indenting, pre-cboard time though. I'm sure we're all of the same mind that badly indented code is bad, right? Then why say that universally well indented code isn't the best?

    edit:
    >> Oh...and I have never experienced the board messing up tabs. The python code I posted earlier used tabs...looks great to me.
    Consider code that people copy at .. say ... 7 {}'s in with long commenting ... *shudder*
    Last edited by twomers; 04-06-2007 at 03:24 AM.

  4. #34
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> Consider code that people copy at .. say ... 7 {}'s in with long commenting ... *shudder*


    The votes are pretty close, I really dont see why people dont see the problem with tabs...
    I personaly use three spaces to indent rather than four, but even then, the Hbar get to long.
    DavidP, should've made the poll public.

  5. #35
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    Get a decent code editor, then

    It will indent code by your chosen tab stops (insert multiple spaces) when you press tab.
    It will automatically indent the next line when you press return.
    It will re-indent code as you copy/paste it if necessary.
    And so on and so on...

    You people pressing space 12 times just to indent 3 tabs stops really need to figure out how the tools work (or pick a better strawman to knock down).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #36
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    How do you delete those 12 spaces? You have to select them and delete or hit backspace 12 times. How do you use the arrow keys to maneuver through those spaces?

    Spaces are simply more cumbersome than tabs. The reason people prefer spaces is that their other advantages outweigh that cumbersomenessosity.

  7. #37
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    >> How do you use the arrow keys to maneuver through those spaces?

    How do you delete the spaces? ctrl + backspace!! Or if you just want to maneuver through a word or so, ctrl + DIRECTION KEY should do it. SPACES FOR PRESIDENT!

  8. #38
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    I personally use spaces all of the time, never tabs. But I have a nice editor that indents code for me; I only have to hit the spacebar four times at the beginning of a block. If I was using notepad I might be tempted to use tabs . . .

    Plus the extra spaces increase your source file size to make it look more impressive.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  9. #39
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by Daved View Post
    How do you delete those 12 spaces?
    I usually don't unless they're in comments. I generally click on this button, which also has the effect of reformatting the whole file if nothing is selected (or only the selection):
    Attached Images Attached Images  
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  10. #40
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,781
    SPACES FOR PRESIDENT!
    We're winning! Just a few more votes and we'll have a sufficient majority to elect spaces pope! heheh

    Plus the extra spaces increase your source file size to make it look more impressive.
    I thought that was a downside to using a "pure spaces" approach, actually... but I guess it depends on your point of view

    I usually don't unless they're in comments. I generally click on this button, which also has the effect of reformatting the whole file if nothing is selected (or only the selection)
    What text editor or IDE do you use?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #41
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Most of the time, it doesn't matter wether you use tabs or spaces, 'cause you only have to use them at the beggining of an indentation, the IDE will do the rest for you.

    >> We're winning! Just a few more votes and we'll have a sufficient majority to elect spaces pope! heheh
    How many votes is that?

    BTW:
    >> SPACES FOR PRESIDENT!

  12. #42
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    >> How many votes is that?
    Duh! 42 ... Can you do anything about that, Salem

  13. #43
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Okay,.. why 42???




    >> Duh! 42 ... Can you do anything about that, Salem

  14. #44
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    >> Okay,.. why 42???

    You jest ... ?

  15. #45
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,781
    Nah, 42 is good, but we only need 24 at the moment.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 3 of 4 FirstFirst 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing 3 spaces to tabs
    By dnguyen1022 in forum C Programming
    Replies: 2
    Last Post: 12-21-2008, 11:51 PM
  2. Handling spaces in command line arguments
    By starkhorn in forum C++ Programming
    Replies: 7
    Last Post: 11-16-2004, 01:42 PM
  3. Replies: 5
    Last Post: 06-30-2003, 12:52 PM
  4. tabs to spaces with dev c++ v.4
    By stallion in forum Windows Programming
    Replies: 2
    Last Post: 01-28-2003, 01:07 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21