"char *" diff in header & func arg list?

kourama kourama@teksavvy.com
Mon Mar 26 18:09:00 GMT 2007


I have noticed something that seems wrong to me, and I'd like to know if
anyone can confirm the bug or explain the seemingly strange behaviour.
Attached is a set of files which demonstrates the problem:

http://www.nabble.com/file/7426/a.c a.c 
http://www.nabble.com/file/7427/b.c b.c 
http://www.nabble.com/file/7428/Makefile Makefile 

When the aa function in a.c declares "char *arg" in it's argument list, it
gets a pointer, which means that "char *arg" is equivalent to "char arg[]"
in the argument list.

However, in the file b.c, the declaration "extern char *myarray" is treated
differently from "extern char myarray[]"

It seems to me that, based on the context, the two should be equivalent, but
GCC doesn't treat them that way.

So, is this a bug, legacy behaviour or is this just another wrinkle in the
sharpei puppy that is C?

Many thanks.
-- 
View this message in context: http://www.nabble.com/%22char-*%22-diff-in-header---func-arg-list--tf3468423.html#a9677694
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list