Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: Please vote!
Home

[Freeciv-Dev] Re: Please vote!

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Please vote!
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Nov 2001 14:25:50 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Nov 29, 2001 at 02:06:31PM +0100, Reinier Post wrote:
> B.  There's a difference in meaning for 'static' variables:
> 
> | #include <stdio.h>
> | 
> | static int x()
> | {
> |   static int the_x = 1;
> |   return ++the_x;
> | }
> | 
> | int main(int argc, char *argv[])
> | {
> |   printf("%d\n", x());
> |   printf("%d\n", x());
> |   printf("%d\n", x());
> | }
> 
> prints
> 
> 2
> 3
> 4
> 
> (It doesn't without the 'static'.)
> It seems clearer to restrict the syntax to static var initializations only.

You mean non-static?

> No preference - I use both.  I also use
> 
>    /* B */
>    int foo3b(int x)
>    {
>      x = 3;
>        /* assign 3 to x */
>    }

This is IMHO ugly.

> >> /****************************
> >>  * 7: merge declaration lines
> >>  ****************************/
> >> 
> >> /* A */
> >> int foo7a(struct city *pcity)
> >> {
> >>   int total, cost;
> >>   int build = pcity->shield_stock;
> >> }
> >> 
> >> /* B */
> >> int foo7b(struct city *pcity)
> >> {
> >>   int total, cost, build = pcity->shield_stock;
> >> }
> 
> A slight preference for A.  I wasn't sure if in
> 
> | #include <stdio.h>
> | 
> | int main(int argc, char *argv[])
> | {
> |   char c,d = 65;
> |   printf("%c\n", d);
> | }
> 
> d would be an int.  (It isn't; the program prints 'A'.)

How does this depend on the question 7?

> >> /*************************
> >>  * 8: double dereferencing
> >>  *************************/
> >> 
> >> /* A */
> >> int foo8a(struct city *pcity)
> >> {
> >>   struct player *owner = city_owner(pcity);
> >>   struct nation_type *nation = get_nation_by_plr(owner);
> >> }
> >> 
> >> /* B */
> >> int foo8b(struct city *pcity)
> >> {
> >>   struct player *owner = city_owner(pcity);
> >>   struct nation_type *nation;
> >> 
> >>   nation = get_nation_by_plr(owner);
> >> }
> 
> How is this different from case 1?

A uses owner in the second line. So you can't swap the lines anymore.

> Has there been a vote on all the indent(1) options?)

No. And I think we shouldn't do this. This just add more opinions and
we wouldn't come to an end anytime soon.

>   /* A */
> 
>   while (*i++)
>   {
>     continue;
>   }
> 
>   /* B */
> 
>   while (*i++)
>   {
>   }
> 
>   /* C */
> 
>   while (*i++) {}
> 
>   /* D */
> 
>   while (*i++);

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

    /* F */
    disallow such constructs

My vote: E or maybe also A

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "The Internet is really just a series of bottlenecks 
  joined by high speed networks."
    -- Sam Wilson


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