Incorrect warning message?
It's an example:
void c(const char *s){}
void cc(const char **p){}
void x()
{
char *s;
c(s);
cc(&s);
}And it's the warning GCC produces for it:
bug.c: In function `x':
bug.c:7: warning: passing arg 1 of `cc' from incompatible pointer type
Is this message correct? Doesn't the <const char> for the second defun's declaration mean exactly the same as it means for the first - the fact that defun doesn't modify the content of the corresponding array?
Quoted 11 lines · Denis Zaitsev
It's an example:
void
c(const char *s){}
voidcc(const char **p){}
voidx(){ char *s; c(s); cc(&s); }
Quoted 6 lines
And it's the warning GCC produces for it:
bug.c: In function `x':
bug.c:7: warning: passing arg 1 of `cc' from incompatible pointer typeIs this message correct?
Read question 11.10 of the C faq.
http://www.eskimo.com/~scs/C-faq/q11.10.html
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 15 lines · Andreas Schwab
Quoted 13 lines · Denis Zaitsev
It's an example:
void
c(const char *s){}
voidcc(const char **p){}
voidx(){ char *s; c(s); cc(&s); }And it's the warning GCC produces for it:
Quoted 8 lines
Quoted 4 lines
bug.c: In function `x':
bug.c:7: warning: passing arg 1 of `cc' from incompatible pointer typeIs this message correct?
Read question 11.10 of the C faq.
Thanks. It's interesting. :)
Quoted 6 lines · Denis Zaitsev
Quoted 3 lines · Andreas Schwab
Read question 11.10 of the C faq.
Thanks. It's interesting. :)
That FAQ answer is poor. You can find the real reason in the answer to question 1 in
http://www.jamesd.demon.co.uk/csc/faq.html#PartC
(this is for C++ but the reasoning applies to C as well).
Quoted 6 lines · Joe Buck
Quoted 5 lines · Denis Zaitsev
Quoted 3 lines · Andreas Schwab
Read question 11.10 of the C faq.
Quoted 8 lines
Quoted 1 line
Thanks. It's interesting. :)
That FAQ answer is poor. You can find the real reason in the answer to question 1 in
http://www.jamesd.demon.co.uk/csc/faq.html#PartC
(this is for C++ but the reasoning applies to C as well).
Thanks. Good explanation.