[Freeciv-Dev] Re: coding standard patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Per I. Mathisen wrote:
Please read and criticize.
Index: doc/CodingStyle
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/CodingStyle,v
retrieving revision 1.2
diff -u -r1.2 CodingStyle
--- doc/CodingStyle 2002/08/12 17:14:21 1.2
+++ doc/CodingStyle 2002/08/28 18:12:36
@@ -14,8 +14,11 @@
- An empty line should be placed between two separate blocks of code.
-- Spaces should go before and after operators, and after commas:
+- Do not use tabs. Indentation should be by two spaces for each level
+ of code nesting.
+- Spaces should go before and after operators, expressions and commas:
+
int a,b,c; /* bad */
int i, j, k; /* good */
Call me crazy, but I'm a big fan of tabs.
I can see how FreeCiv doesn't make good use of them, though. The ideal
use for tabs is as a single level of indentation - that way if someone
prefers a different level of indentation they can just change their tab
width. But with an indentation level of 2 and a tab width of 8 this
doesn't work - it just serves to make sure that people have to use a tab
width of 8.
---side note---
To carry things a little farther, emacs and indent will automatically
indent using tabs (or automatically strip tabs). But under the system
of indentation I describe above, not *all* spaces should be replaced by
tabs. Consider:
int foo(void)
{
\tint x;
\tcall_some_function(x, y
\t z);
}
Here I have written \t instead of a two-space tab. The above is the
"proper" indentation: no matter how you change the tab/indentation width
it will always look correct (although it may flow off the screen). But
emacs and indent will give you this:
\tcall_some_function(x, y
\t\t\t\t\t\t\t\t\t\t z);
which will again only work with a tab width of 2.
Does anyone know how to get the first behavior instead of the second (in
emacs or indent)?
jason
- [Freeciv-Dev] coding standard patch, Per I. Mathisen, 2002/09/18
- [Freeciv-Dev] Re: coding standard patch,
Jason Short <=
- [Freeciv-Dev] Re: coding standard patch, Reinier Post, 2002/09/20
- [Freeciv-Dev] Re: coding standard patch, Gregory Berkolaiko, 2002/09/21
- [Freeciv-Dev] Re: coding standard patch, Ben Webb, 2002/09/22
- [Freeciv-Dev] Re: coding standard patch, Raimar Falke, 2002/09/23
- [Freeciv-Dev] Re: coding standard patch, Per I. Mathisen, 2002/09/23
- [Freeciv-Dev] Re: coding standard patch, Jason Short, 2002/09/23
- [Freeciv-Dev] Re: coding standard patch, Raimar Falke, 2002/09/23
|
|