Article View: gnu.gcc.bug
Article #2799-Wcast-qual bug?
From: Jan Edler
Date: Thu, 04 Jan 1990 17:54
Date: Thu, 04 Jan 1990 17:54
26 lines
1000 bytes
1000 bytes
Consider the following example, compiled with -Wcast-qual:
int
g(int *x, int *y)
{
return *x + *y;
}
int
f()
{
static int foo;
const int bar;
return g(&foo, &bar);
}
The compiler says
x.c: In function f:
x.c:12: warning: pointer to const given for argument 1 of `g'
I claim the argument number given in the warning is off by one.
I suppose you might feel that arguments are "naturally" zero-origin,
but I wasted 10 minutes on a real case because I assumed argument 3
was the third argument to a function.
Jan Edler
Technical Details
Message-ID:
<9001041754.AA00548@jan.ultra.nyu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!JAN.ULTRA.NYU.EDU!edlerShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!JAN.ULTRA.NYU.EDU!edler From: edler@JAN.ULTRA.NYU.EDU (Jan Edler) Newsgroups: gnu.gcc.bug Subject: -Wcast-qual bug? Message-ID: <9001041754.AA00548@jan.ultra.nyu.edu> Date: 4 Jan 90 17:54:16 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 26