Menu

#293 global function recognized with file scope (C)

open
nobody
None
5
2010-10-06
2010-10-06
Chris H
No

ctags detects global function prototypes with file scope.
The definition is detected correctly though...

example code:
------------------------------------
int func(int i);

int main ()
{
return 0;
}

int func(int i)
{
return i+1;
}
------------------------------------
ctags output:
------------------------------------
func test_func.c /^int func(int i);$/;" p line:1 file: signature:(int i)
main test_func.c /^int main ()$/;" f line:4
func test_func.c /^int func(int i)$/;" f line:9 signature:(int i)

Discussion

  • Chris H

    Chris H - 2010-10-06

    example code

     
  • Chris H

    Chris H - 2010-10-07

    I just noticed, that this only happens if it's a *.c file.
    If i save the same code in a *.h file, the function is recognized as global correctly.

    But also, if i declare one of the functions in *.h file static, it's still recognized as global. I know it's unusual to declare functions in a *.h file static but it's a bug after all, isn't it?

     

Log in to post a comment.