Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2623) A minor style issue
Home

[Freeciv-Dev] Re: (PR#2623) A minor style issue

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#2623) A minor style issue
From: "Gregory Berkolaiko via RT" <rt@xxxxxxxxxxxxxx>
Date: Fri, 20 Dec 2002 13:06:10 -0800
Reply-to: rt@xxxxxxxxxxxxxx

Following comments by Per, I reworded my changes.

G.

On Fri, 20 Dec 2002, Gregory Berkolaiko via RT wrote:

> 
> Following the discussion concerning the use of 
>       if (i > 0) {
> vs
>       if(i > 0) {
> 
> I introduced the corresponding amendment to the CodingStyle.
> 
> Strangely, indent -kr will also introduce space after a "while" and a 
> "for":
>       while (i > 0) {
> and
>       for (i = 0; i < 10; i++) {
> 
> I don't think we should enforce it now, but at least the CodingStyle 
> itself should comply to what it proclaims to be the case.
> 
> 

? pitfight.sh
? pitfight_g.sh
? score.log
? test.c
Index: doc/CodingStyle
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/CodingStyle,v
retrieving revision 1.4
diff -u -r1.4 CodingStyle
--- doc/CodingStyle     2002/12/11 15:29:25     1.4
+++ doc/CodingStyle     2002/12/20 21:04:53
@@ -16,9 +16,10 @@
   "indent -kr -i2 -l77").  However, do not re-indent areas of code you
   are not modifying or creating. Here are the most important properties:
     - lines are at most 77 chars long
-    - spaces are inserted before and after operators ("int i, j, k;"
-      instead of "int a,b,c;" and "if (foo <= bar) c = a + b;" instead
-      of "if(foo<=bar) c=a+b;")
+    - spaces are inserted before and after operators (instead of 
+      "int a,b,c;" use "int i, j, k;" and instead of "if(foo<=bar) c=a+b;"
+      use "if (foo <= bar) c = a + b;" -- note the space between "if" 
+      and the bracket)
     - function braces begin and end in the first column.
         int foo()
         {
@@ -77,7 +78,7 @@
 - Comments in conditionals. If you need a comment to show program flow,
   it should be below the if or else:
 
-  if(is_barbarian(pplayer)) {
+  if (is_barbarian(pplayer)) {
     x++;
   } else {
     /* If not barbarian, ... */
@@ -160,7 +161,7 @@
 - If an empty block is needed you should put an explanatory comment in
   an empty block (i.e. {}):
 
-  while(*i++) {
+  while (*i++) {
     /* nothing */
   }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#2623) A minor style issue, Gregory Berkolaiko via RT <=