This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
"char *" diff in header & func arg list?
- From: kourama <kourama at teksavvy dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 26 Mar 2007 10:28:34 -0700 (PDT)
- Subject: "char *" diff in header & func arg list?
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.