Okay, just curious again: How many spaces do you indent? I indent 4 spaces. I think 4 will be the majority.
Okay, just curious again: How many spaces do you indent? I indent 4 spaces. I think 4 will be the majority.
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.
Tab.
To code is divine
never tab unless you have tabs set to insert spaces.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
Well, how much does the tab indent in your editor?
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.
You know, I agree. Tabs can really mess up your indentation. But everyone seems to use them.never tab unless you have tabs set to insert spaces.
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.
I let Dev-C++ indent for me, unless an if statement indents too far, then I set it to about 7. Otherwise, it's 4 or 5. So I selected all three options above.
If you can manage not to mix the two, tabs are fine. 2 or 3 spaces are not enough. Use 4 or more.never tab unless you have tabs set to insert spaces.
You guys are weird. I ALWAYS indent 4 spaces.
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.
My experience doesn't justify this statement. In my opinion, 1 is too little, but 2 is enough if the code is formatted consistently. 4 can easily be too much with some styles of C and most styles of C++ where lines can get pretty long, and the indention doesn't help.2 or 3 spaces are not enough. Use 4 or more.
Just because I don't care doesn't mean I don't understand.
Does anyone actually indent 1 space?
I know Govtcheez voted for everything, but I doubt he uses 1 space. Well, maybe.
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.
Well, if you transfer it, it sometimes ends up looking like this:
Code:int main(void) { if(1) { printf("hi"); } return 0; }
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.
Yup. I use 2. 4 is too much; especially if you have to keep it under 80 char per line, those indents add up quickly.
source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense
If they "add up quickly", modularize your program (ie, break it up into functions). One of my books suggests that you shouldn't go over three levels of indentation, but I don't go that far.
But I think 8 is too much, for all that.
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.
If your lines are too long it's not the tab size that is the problem.