View Poll Results: What kind of text alignment do you prefer?
- Voters
- 8. You may not vote on this poll
-
I (or my employer) prefer alignment using tabs
-
I (or my employer) prefer alignment using spaces
-
I / we need a mixture of both
-
I / we have no preference
-
November 11th, 2009, 02:34 AM
#1
Tabs or Spaces ?
These days I've noticed that a lot of code editors have the option to expand tabs (on opening a source file) and replace them with space characters - i.e. if you open the source file, you'll now have (say) four spaces wherever you used to have a tab. What's the general preference nowadays? Tabs or spaces?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
November 11th, 2009, 03:54 AM
#2
Re: Tabs or Spaces ?
Well, such an option (to expand tabs) exists since at least 3 or more decades. I used it in ME editor (I replaced tabs with spaces) while writing FORTRAN code.
Now I use Tabs for alignments. I use, however, spaces as a separator (after commas, around < > = signs and so on ...)
Victor Nijegorodov
-
November 11th, 2009, 04:28 AM
#3
Re: Tabs or Spaces ?
 Originally Posted by VictorN
Well, such an option (to expand tabs) exists since at least 3 or more decades.
Really? I only started noticing it a few years ago! For my own programs I've started to prefer using spaces for indentation, rather than tabs but it can be quite annoying when working on a collaborative project. Many 'diff' programs aren't intelligent enough to ignore differences in indentation (and of course, there are programming languages where indentation is important). So for a collaborative project, I just have to "go with the flow".
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
November 11th, 2009, 06:17 PM
#4
Re: Tabs or Spaces ?
My preference is for using tabs; however, many source code tools can't handle the tabs, so often times using spaces is required.
I go with the flow on projects like that but it makes backspacing more of a pain.
One thing cool with an editor like Visual Studio (2005 or higher) is that you can set up your preferences for indentation, spaces, tabs, curly braces and so forth and the code with auto format upon block or statement completion. You can also format the selection or the whole document. If you work as a team you can just pass around the preferences file (by exporting the settings) to other team members. Then you really don't need to go over formatting as much in code reviews.
-
November 11th, 2009, 07:03 PM
#5
Re: Tabs or Spaces ?
yeah tabs are a lot easier to deal with. code::blocks allows you to reformat the entire source code to your customized preference instantly
0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000 0000 0000 0000 0000
-
November 12th, 2009, 01:22 AM
#6
Re: Tabs or Spaces ?
Joeman - could you tell me how to do that in Code::Blocks?
Funnily enough, it was C::B that brought this to mind for me. I upgraded it about a month ago and for the past month it's been relentlessly turning all my tabbed indentations into spaces. For my own projects I found that I actually prefer spaces but for collaborative projects it's been a royal PITA.
I found a setting that would stop C::B from doing it in future but I didn't see a way to undo the damage it's already done - i.e. a way to change every (say) 4 spaces, into an indent. Is that possible?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
November 12th, 2009, 02:08 AM
#7
Re: Tabs or Spaces ?
I haven't really needed to try to go back and forth from spaces to tabs. However I believe all you need to do is go under the menu to editor, scroll down to source formatter in the left column list, click customize, go under the tab called Indentation and select "Use TABs instead of spaces" and "Force using TABs". These are probably selected already. After that, run the source formatter plugin.
If this doesn't work, perhaps just turning on Backspace unindents would suffice.
0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000 0000 0000 0000 0000
-
November 12th, 2009, 06:49 AM
#8
Re: Tabs or Spaces ?
Rate my post if i it was useful!
-
November 16th, 2009, 08:35 PM
#9
Re: Tabs or Spaces ?
VS2010, with it's WPF editor. Use the mouse wheel to zoom in on code
-
November 17th, 2009, 09:14 AM
#10
Re: Tabs or Spaces ?
The convention in my company is that we use spaces instead tabs. No everybody complies though. I don't know which are to be preferred. I can work with both. But I don't like when different people in the same team use different conventions because that messes the source files.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|