Warning on cast to const

Falk Hueffner hueffner@informatik.uni-tuebingen.de
Mon Mar 29 07:57:00 GMT 2004


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



More information about the Gcc mailing list