Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: Coding Guideline --- more variants
Home

[Freeciv-Dev] Re: Coding Guideline --- more variants

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Coding Guideline --- more variants
From: Reinier Post <rp@xxxxxxxxxx>
Date: Thu, 29 Nov 2001 16:25:55 +0100

> 11a: always braces
>   switch(a) {
>   case 2:
>   {
>     return 2;
>   }
>   case 3:
>   {
>     int x;
>     ....
>   }

This (11a) is my preference.

BTW I seem to remember some C compilers or standards don't allow
such intra-block variable declarations, while I much prefer them myself,
I even create blocks to introduce them:

int foo()
{
  int i;

  i=changing(i);

  {
    int j;

    for (j=0; j<i; ++j) {
      i=foo(j);
    }
  }

  return i;
}

Has this been sorted out?  Have we voted on this?

QUESTION 11.5: declarations within blocks

/* A */  all declarations at start
/* B */  declarations within block if possible
/* C */  even create blocks to scope declarations where appropriate

My preference: C.

-- 
Reinier


[Prev in Thread] Current Thread [Next in Thread]