Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Voting results for first part of style guide questionnaire
Home

[Freeciv-Dev] Voting results for first part of style guide questionnaire

[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] Voting results for first part of style guide questionnaire
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 3 Dec 2001 17:44:43 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

Gregory Berkolaiko has put together the results of the first part of
the style guide questionnaire:

Gregory Berkolaiko: 
        1A! 2B  3B  4A  5-  6A  7A  8A
Greg Wooledge: 
        1A  2B  3A  4A  5A  6A
Daniel Sjölie
        1B? 2B! 3A? 4A  5A  6A!
Raimar Falke
        1A  2B  3B  4A  5A  6A  7B  8A  9B
Tony Stuckey
        1A  2A  3B  4-  5-  6-
Petr Baudis
        1B  2A  3A  4A  5A  6A  7A  8A  9A
Andrew Sutton
        1B  2B  3B  4A  5A  6A  7C  8A  9A
Mike Kaufman
        1A  2B  3-  4A  5B  6B  7A  8A
Jeff Mallatt
        1A  2B  3B  4A  5A  6A  7C  8A  9A
Petrus Viljoen
        1A  2B  3B  4A  5A  6A  7B  8A  9A
Stepan Roh
        1A  2B  3B  4A  5A  6A  7C  8A? 9A
Daniel Speyer
        1A  2A  3A  4B  5B  6B* 7A  8A  9A
Jason Short
        1A! 2B  3B* 4A! 5B  6A  7A* 8A
Miguel Farah
        1B  2B  3A  4B  5A  6A  7A  8A
Ross Wetmore
        1-  2-  3B  4A? 5-  6-  7-  8-

Result: 1A  2B  3B  4A  5A  6A  7A  8A  9A

So these are the result:

 * 1: init vars 
 * 2: empty line after vars 
 * 3: comments code above and not right and not below
 * 4: extra {} on iterates 
 * 5,6: always put braces on if and else blocks
 * 7: merge declaration lines
 * 8: allow double dereferencing in declaration lines
 * 9: comments in declarations are at the right and not above

So if there is anybody who can't live with this: speak up now.

And now to the second part. Gregory Berkolaiko has collected these
questions:

/*******************
 * 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++) {}

  /* 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--;
  }
}

My votes:
 10C 
 11B 
 no hard opinion about 12 this really depends on the context
 13 A or E or F 
 14D

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "I do feel kind of sorry for Microsoft. Their attornies and marketing
  force must have tons of ulcers trying to figure out how to beat (not
  just co-exist with) a product that has no clearly defined (read
  suable) human owner, and that changes on an hourly basis like the
  sea changes the layout of the sand on a beach. Severely tough to
  fight something like that."
    -- David D.W. Downey at linux-kernel


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