S
Spoon
Hello,
I don't understand why gcc barks at me in this situation:
$ cat foo.c
extern void func(const int * const list[], int nent);
int main(void)
{
int *p[5];
func(p, 5);
return 0;
}
$ gcc -Wall -std=c89 -c foo.c
foo.c: In function `main':
foo.c:6: warning: passing arg 1 of `func' from incompatible pointer type
AFAIU, func promises not to change the values pointed to by the pointers
in the array (i.e. *list[2] = 666 is illegal) AND not to change the
pointers themselves (i.e. list[2] = NULL is also illegal).
I don't understand what the compiler dislikes about p.
Could someone enlighten me?
I don't understand why gcc barks at me in this situation:
$ cat foo.c
extern void func(const int * const list[], int nent);
int main(void)
{
int *p[5];
func(p, 5);
return 0;
}
$ gcc -Wall -std=c89 -c foo.c
foo.c: In function `main':
foo.c:6: warning: passing arg 1 of `func' from incompatible pointer type
AFAIU, func promises not to change the values pointed to by the pointers
in the array (i.e. *list[2] = 666 is illegal) AND not to change the
pointers themselves (i.e. list[2] = NULL is also illegal).
I don't understand what the compiler dislikes about p.
Could someone enlighten me?