If you use tabs as a rule
If you use spaces as a rule
(in regards to code indentation)
Printable View
If you use tabs as a rule
If you use spaces as a rule
(in regards to code indentation)
I always use TAB in code. It is much simpler, less key strokes, and cleaner looking.
I use tabs, but have them replaced with spaces (5), so they look the same on all file editors.
^ that's what I do... plus, when I have to use spaces, I always misalign by a space or so... and when you start nesting more and more stuff, you (I) spend way too much time worrying about exact spacing...
Spaces. I turn on the "turn tabs into spaces" option in VC++7.1 and set tabs to 2 spaces.
Why?
Because tabs cause all sorts of problems with porting to other IDEs. If you are using one IDE which has tabs set to a certain size but are using code from multiple sources which uses tabs set at other sizes then the formatting goes to hell! Not all IDEs use the same tabbing size by default. Not only that, but on all IDEs I've used, default tabbing is set to be too high anyways (they are usually set to between 4 and 6 spaces wide). If you use the "convert tabs to spaces" option (which inserts spaces instead of tabs when you use the tab key) when you are coding, then this problem never occurs. You are guaranteed that your code will be formatted exactly the way you want it no matter who uses it on whichever IDE they choose.
Two spaces is what I use.
My editor mostly does the tabbing for me in a spiffy auto check feature.
I use tabs myself, seems a lot easier than hitting space five times.
I use tabs.
I use spaces, too, for reasons already mentioned. I sometimes wonder how a person can use tabs instead of spaces and still call themselves human!
Two spaces... If auto-indent is available with spaces, I use that (set to 2, of course).
I use spaces because that is what I am told to use.
tabs to spaces option with it set to 2 spaces.
TABed, because its less tedious and is good practice if you script in other languages as well.
2 space tabs? Wow! I use 8-space tabs! That does make the code long vertically, but it looks cleaner to me.
though, some of my editor's use 4-space tabs
Quote:
Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.
Rationale: The whole idea behind indentation is to clearly define where a block of control starts and ends. Especially when you've been looking at your screen for 20 straight hours, you'll find it a lot easier to see how the indentation works if you have large indentations.
Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.
In short, 8-char indents make things easier to read, and have the added benefit of warning you when you're nesting your functions too deep. Heed that warning.
haha, I really hope that was a joke.Quote:
Originally posted by Brian2
Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.
Rationale: The whole idea behind indentation is to clearly define where a block of control starts and ends. Especially when you've been looking at your screen for 20 straight hours, you'll find it a lot easier to see how the indentation works if you have large indentations.
Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.
In short, 8-char indents make things easier to read, and have the added benefit of warning you when you're nesting your functions too deep. Heed that warning.
http://pantransit.reptiles.org/prog/CodingStyle.htmlQuote:
haha, I really hope that was a joke.
*shudders*
I'm so glad I don't follow that convention
I have auto indent set to 4 spaces, but also have TAB converted to spaces. It is easier to cut and paste into html documents like that.
Tab here... why would you use spaces? More keystrokes, have to keep track of how many... just tab it. *BAM* or *BAM BAM* and everything is lined up.
you poll lacks an "other" option.
I neither tab nor space. I indent.
::lifting nose higher and higher...::
>>> ::lifting nose higher and higher...::
Is that a bogie I see up there?
Ober:
>>> Tab here... why would you use spaces?
You press Tab as normal, but you tell your IDE that when you press TAB it is to inesert 4 spaces. Thus no additional keystrokes are required, and no fiddling about is needed if you cut and paste a bit of code into another IDE or into NotePad for example.
>>Is that a bogie I see up there?<<
NO, ITS PIERCED!
DrakkenKorin:
.................... "other"?:)
Polymorphic OOP:
I didn't know that option existed (space replace tab thingy), but I don't use VC I only use Dev-C++.
I try to use tabs, and I have my tab set to 4 spaces, but I don't want the extra job of making sure I hit the spacebar 4 times when I can hit the TAB once. But yes, maybe I will make a cpp process script that converts TAB's to 4 Spaces in the file.
VIM does it for me. I find two spaces much easier to read.Quote:
More keystrokes, have to keep track of how many
IIRC tabs are actually 5 characters, its been that way since the days of typewriters. Set your word processor to a fixed width font and try it out. Its 5 characters. So the arguement that it is 8 characters and not 4, 2, 12, or pi is bull$$$$.Quote:
Tabs are 8 characters
Dev-C++ should also have that option.Quote:
Originally posted by BillBoeBaggins
DrakkenKorin:
.................... "other"?:)
Polymorphic OOP:
I didn't know that option existed (space replace tab thingy), but I don't use VC I only use Dev-C++.
I try to use tabs, and I have my tab set to 4 spaces, but I don't want the extra job of making sure I hit the spacebar 4 times when I can hit the TAB once. But yes, maybe I will make a cpp process script that converts TAB's to 4 Spaces in the file.
I use five spaces.
Three spaces with the tab-to-space feature (which also allows shift-tab).
I use tabs. I know the problems associated with them, but they look better to me, and are easier to get rid of / add. Who's gonna read MY code, anyway :D ?
I use 5 space tabs. Dunno why. I guess I'm just lazy.
No, it's not. The number of characters used depends on what font size you're using. At least that's the case in Word 2002.Quote:
Originally posted by Thantos
IIRC tabs are actually 5 characters, its been that way since the days of typewriters. Set your word processor to a fixed width font and try it out. Its 5 characters.
And as for tab sizes, the standard is 8 spaces, nothing else.
In some programming languages this is part of the language definition (Python and Haskell for example).
I use a tabstop of four spaces though.
Spaces all the way! Two spaces all the way!
- SirCrono6Code:#include <iostream>
int main( void )
{
std :: cout << "Hello World!" << std :: endl;
return 0;
}
Am I the only one who uses three space tabs then? I think 3 is perfect for readability.
Leeme quote myself. :DQuote:
Originally posted by Speedy5
Three spaces with the tab-to-space feature (which also allows shift-tab).
3 is perfect as it is in many other cases
i have tab set to four spaces becuase of cout... example:Code:cout<<"blah blah blah blah"<<endl
<<"second line blah blah blah"<<endl;
When I first saw the post I was excited, thinking it was a music discussion. I do have to say I am disappointed!:p
There is no reason to use int main(void) in c++Quote:
Originally posted by SirCrono6
Spaces all the way! Two spaces all the way!
- SirCrono6Code:#include <iostream>
int main( void )
{
std :: cout << "Hello World!" << std :: endl;
return 0;
}
int main() is exactly the same.
Then why waste the time to question it?Quote:
Originally posted by Brian2
There is no reason to use int main(void) in c++
int main() is exactly the same.
Yeah, I know. I don't normally use it anyway :D.
All the way!Code:int main(int argc, char *argv[])
- SirCrono6
Brian2 would you please stop posting crap. Thank youQuote:
There is no reason to use int main(void) in c++
int main() is exactly the same.
http://faq.cprogramming.com/cgi-bin/...&id=1043284376
...I have Visual C# .net set to 4 spaces and I use Virtual Spaces because if I'm going to be posting a code in the forum, Visual C# .net converts from tabs to spaces. I also use tabs to line up the code. For example:
Code:using System;
using System.Drawing;
using System.Windows.Forms;
namespace Example
{
/// <summary>
/// Main class for the form
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Constructor for a Windows Form class
/// </summary>
public Form1()
{
InitializeComponents()
}
/// <summary>
/// Used for initializing a form and all the controls needed
/// for the application.
/// </summary>
public void InitializeComponents()
{
//
// form1
//
this.Text = "Form 1 Example";
this.BackColor = System.Drawing.Color.Black;
// ...
}
/// <summary>
/// Entry point for starting an application.
/// </summary>
public static void Main(string[] args)
{
Application.Run(form1);
}
}
}
many editors treat tabs and spaces the same way. E.g. if you have 4 spaces and press backspace they all get deleted. If you have 1 one tab and set it to be the size of 4 spaces then it will do the samething. The only difrence is that with spaces you can click everywhere and the caret will be positioned there but with tabs it will be positioned to the begining or end of the tab. Some people (like me) are just to lazy to change the setting becuase of this.
Yeah after looking at it some more I realize its actually going to the same spot of the paper.Quote:
The number of characters used depends on what font size you're using
But if you do put in to Courier New 12pt which is the closest to the typeface that most typewriters used it is 5 spaces which is actually what my point was about :)
I think most of us use spaces regardless (or should it be irregardless?) if we get them by hitting the spacebar or having tabs set to insert spaces instead of the tab character.
That word doesn't exist.Quote:
Originally posted by Thantos
or should it be irregardless?
That's irirelevant.Quote:
Originally posted by Zach L.
That word doesn't exist.
Quote:
Originally posted by Zach L.
That word doesn't exist.
Granted it said that regardless is what should be used but just to counter the doesn't exist comment :)Quote:
www.spellcheck.com
One entry found for irregardless.
Main Entry: ir·re·gard·less
Pronunciation: "ir-i-'gärd-l&s
Function: adverb
Etymology: probably blend of irrespective and regardless
Date: circa 1912
nonstandard : REGARDLESS
usage Irregardless originated in dialectal American speech in the early 20th century. Its fairly widespread use in speech called it to the attention of usage commentators as early as 1927. The most frequently repeated remark about it is that "there is no such word." There is such a word, however. It is still used primarily in speech, although it can be found from time to time in edited prose. Its reputation has not risen over the years, and it is still a long way from general acceptance. Use regardless instead.
But yeah I'm not very good in the proper grammer area.
eyem naught da bestest spellar en tha wourld.