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: Reinier Post <rp@xxxxxxxxxx>
Date: Fri, 30 Nov 2001 00:06:12 +0100

On Thu, Nov 29, 2001 at 02:25:50PM +0100, Raimar Falke wrote:
> 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, I mean: the syntax

  int the_x = 1;

is best avoided.

-- 
Reinier


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