Skip to contentSkip to conversation

Incorrect warning message?

DISCUSSION Denis Zaitsev 3 participants 5 messages Jan 15, 2005 – Jan 18, 2005

lore
Share & tools
lore
#0 lore raw

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?

#1 lore raw
Quoted 11 lines · Denis Zaitsev

It's an example:

void c(const char *s){}
void cc(const char **p){}
void x()

{
    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 type

Is 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."
#2 lore raw
Quoted 15 lines · Andreas Schwab
Quoted 13 lines · Denis Zaitsev

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:

Quoted 8 lines
Quoted 4 lines

bug.c: In function `x':
bug.c:7: warning: passing arg 1 of `cc' from incompatible pointer type

Is this message correct?

Read question 11.10 of the C faq.

http://www.eskimo.com/~scs/C-faq/q11.10.html

Thanks. It's interesting. :)