Web lists-archives.com

Re: compile problem on older program


it seems that gcc just hates a static function declaration inside a function.

This code (without any include)

  static int bla(int x)
   return (x != 1);
  int main()
   static int bla(int x);


  t.c: In function ‘main’:
  t.c:19:13: error: invalid storage class for function ‘bla’
    static int bla(int x);

The compile time error vanishes if i move the declaration out of the function,
or if i remove the "static", or if i remove the declaration completely
(as it is surplus in both programs, mine and Fred's).

I wonder what gives "static int bla(int x);" such a different meaning inside
and outside a function. To my naive but long tested understanding, both
should differ only by their scope.

Have a nice day :)