* Incorrect warning message?
@ 2005-01-15 21:08 Denis Zaitsev
2005-01-15 22:05 ` Andreas Schwab
0 siblings, 1 reply; 5+ messages in thread
From: Denis Zaitsev @ 2005-01-15 21:08 UTC (permalink / raw)
To: gcc, linux-gcc
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?
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Incorrect warning message?
2005-01-15 21:08 Incorrect warning message? Denis Zaitsev
@ 2005-01-15 22:05 ` Andreas Schwab
2005-01-15 22:32 ` Denis Zaitsev
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2005-01-15 22:05 UTC (permalink / raw)
To: gcc; +Cc: linux-gcc
Denis Zaitsev <zzz@anda.ru> writes:
> 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?
Read question 11.10 of the C faq.
http://www.eskimo.com/~scs/C-faq/q11.10.html
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
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."
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Incorrect warning message?
2005-01-15 22:05 ` Andreas Schwab
@ 2005-01-15 22:32 ` Denis Zaitsev
2005-01-17 16:48 ` Joe Buck
0 siblings, 1 reply; 5+ messages in thread
From: Denis Zaitsev @ 2005-01-15 22:32 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gcc, linux-gcc
On Sat, Jan 15, 2005 at 11:05:44PM +0100, Andreas Schwab wrote:
> Denis Zaitsev <zzz@anda.ru> writes:
>
> > 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?
>
> Read question 11.10 of the C faq.
>
> http://www.eskimo.com/~scs/C-faq/q11.10.html
Thanks. It's interesting. :)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Incorrect warning message?
2005-01-15 22:32 ` Denis Zaitsev
@ 2005-01-17 16:48 ` Joe Buck
2005-01-18 23:12 ` Denis Zaitsev
0 siblings, 1 reply; 5+ messages in thread
From: Joe Buck @ 2005-01-17 16:48 UTC (permalink / raw)
To: Andreas Schwab, gcc, linux-gcc
On Sun, Jan 16, 2005 at 03:32:42AM +0500, Denis Zaitsev wrote:
> On Sat, Jan 15, 2005 at 11:05:44PM +0100, Andreas Schwab wrote:
> > Read question 11.10 of the C faq.
> >
> > http://www.eskimo.com/~scs/C-faq/q11.10.html
>
> 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).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Incorrect warning message?
2005-01-17 16:48 ` Joe Buck
@ 2005-01-18 23:12 ` Denis Zaitsev
0 siblings, 0 replies; 5+ messages in thread
From: Denis Zaitsev @ 2005-01-18 23:12 UTC (permalink / raw)
To: Joe Buck; +Cc: Andreas Schwab, gcc, linux-gcc
On Mon, Jan 17, 2005 at 08:48:59AM -0800, Joe Buck wrote:
> On Sun, Jan 16, 2005 at 03:32:42AM +0500, Denis Zaitsev wrote:
> > On Sat, Jan 15, 2005 at 11:05:44PM +0100, Andreas Schwab wrote:
> > > Read question 11.10 of the C faq.
> > >
> > > http://www.eskimo.com/~scs/C-faq/q11.10.html
> >
> > 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-18 23:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-15 21:08 Incorrect warning message? Denis Zaitsev
2005-01-15 22:05 ` Andreas Schwab
2005-01-15 22:32 ` Denis Zaitsev
2005-01-17 16:48 ` Joe Buck
2005-01-18 23:12 ` Denis Zaitsev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.