global variable named index

If I have a global variable named index, clang-cc throws an error saying redefinition of index as different kind of symbol. Why can’t I have a variable named index?

Thanks

Vasudev

‘index’ is the name of a function defined by the C standard library. Try ‘man index’ on the command line.

-Chris

Chris Lattner wrote:

If I have a global variable named index, clang-cc throws an error saying redefinition of index as different kind of symbol. Why can’t I have a variable named index?

'index' is the name of a function defined by the C standard library. Try 'man index' on the command line.

'index' was originally defined in BSD unix. It evolved into 'strchr'.
It is not part of the C standard library, nor is it a part of POSIX (since POSIX.1-2008).

According to the Linux man page, it is defined in "strings.h".

-Rich

It is part of the UNIX'03 Spec

http://www.unix.org/version3/apis/t_2.html

-- Jean-Daniel

My bad, I wrongly interpret the function table. You're right about it no longer part of POSIX.