Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Style vote part 2
Home

[Freeciv-Dev] Style vote part 2

[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] Style vote part 2
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Tue, 4 Dec 2001 16:40:29 +0000 (GMT)

As Raimar mentioned earlier, the voting on the part 2 of style guide is
now open.  I passed the questionnaire through indent -kr -i2, so all the
variants mentioned remain invariant under indent.

If you have voted on any of the questions before Raimar's email
"Voting results for first part of style guide questionnaire", please
resubmit your votes.

Please submit your votes in one line, like:

10A  11C  12F  13M  14Z

this way it is easier for me to record and process them. 

I will send you an acknowledgement email asap and if you don't get
anything for 48 hours, get worried :)

Enjoy the democracy, while it lasts.  HA-HA-HA.

=============== Questionnaire part 2 =======================
/*******************
 * 10: long comments
 *******************/
int foo10(int x)
{

  /* A */
  /* blah
     blah blah
     blah */
  if (x == 0)
    return 1;

  /* B */
  /* blah
   * blah blah
   * blah */
  if (x == 1)
    return 0;

  /* C */
  /* 
   * blah
   * blah blah
   * blah 
   */
  return 42;
}


/**********************
 * 11: braces in switch
 **********************/
int foo11(int x)
{

  /* A (always braces) */
  switch (x) {
  case 2:
    {
      return 2;
    }
  case 3:
    {
      int d = 5;
      return d - x;
    }
  }

  /* B (braces where needed) */
  switch (x + 3) {
  case 2:
    return 2;
  case 3:
    {
      int d = 5;
      return d - x;
    }
  }

  /* C (no extra local variables) */

  {
    int d;
    switch (x) {
    case 2:
      return 2;
    case 3:
      d = 5;
      retrun d - x;
    }
  }
}


/********************************
 * 12: empty lines between blocks 
 ********************************/
int foo(void)
{

  /* A */
  while (*i++) {
    ++j;
  }

  if (j > 10) {
    foo();
  }

  /* B */
  while (*i++) {
    ++j;
  }
  if (j > 10) {
    foo();
  }
}


/******************
 * 13: empty blocks 
 ******************/
int foo13(void)
{

  /* A */
  while (*i++) {
    continue;
  }

  /* B */
  while (*i++) {
  }

  /* C */
  /* while (*i++) {} 
   * is reduced to B by indent */

  /* D */
  while (*i++);

  /* E */
  while (*i++) {
    /* nothing */
  }

  /* F */
  /* !disallow such constructs! */
}


/******************************
 * 14: Comments in conditionals
 ******************************/
int foo14(void)
{
  int x = 0;

  /* A */
  if (is_barbarian(pplayer)) {
    x++;
    /* If not barbarian, ... */
  } else {
    x--;
  }

  /* B */
  if (is_barbarian(pplayer)) {
    x++;
  } else {                      /* If not barbarian, ... */
    x--;
  }

  /* C */
  if (is_barbarian(pplayer)) {
    x++;
  } else {
    /* If not barbarian, ... */
    x--;
  }

  /* D */
  if (is_barbarian(pplayer)) {
    x++;
  } else {                      /* if (is_barbarian(pplayer)) */
    x--;
  }
}


________________________________________________________________
Nokia 5510 looks weird sounds great. 
Go to http://uk.promotions.yahoo.com/nokia/ discover and win it! 
The competition ends 16 th of December 2001.


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Style vote part 2, Gregory Berkolaiko <=