This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning on cast to const
- From: Falk Hueffner <hueffner at informatik dot uni-tuebingen dot de>
- To: clifford at clifford dot at
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 28 Mar 2004 13:06:14 +0200
- Subject: Re: Warning on cast to const
- References: <Pine.LNX.4.58.0403281242000.27631@phoenix.clifford.at>
clifford@clifford.at writes:
> maybe I am wrong, but in my understanding an implicit cast from non-const
> to const should never produce a warning (and usually does not), but:
>
> root@murphy:~# cat demo.c
> void func(const char **p) { }
> int main() {
> const char **demo1=0;
> char **demo2=0;
> func(demo1);
> func(demo2);
> }
>
> root@murphy:~# gcc-x demo.c
> demo.c: In function `main':
> demo.c:6: warning: passing arg 1 of `func' from incompatible pointer type
See http://gcc.gnu.org/ml/gcc-bugs/2000-05/msg00502.html
--
Falk