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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux