Possible Duplicate:
Double pointer const-correctness warnings in C
Programmatically, I want to reassure my callers that a const pointer to a string won't be modified at any level, gcc however moans about this additional const'ing:
gcc -std=c99 -x c - <<EOF
#include <stdio.h>
#include <string.h>
static void
__really_print(const char *const *str, size_t len)
{
for (size_t i = 0; i < len; i++) {
putchar(str[0][i]);
}
return;
}
static void
__print_something(char *const *str)
{
size_t len = strlen(str[0]);
__really_print(str, len);
return;
}
int
main(int argc, char *argv[])
{
__print_something(argv);
return 0;
}
EOF
results in:
<stdin>: In function '__print_something':
<stdin>:17:5: warning: passing argument 1 of '__really_print' from incompatible pointer type [enabled by default]
<stdin>:5:1: note: expected 'const char * const*' but argument is of type 'char * const*'
icc is totally fine with that. What is gcc trying to point out here?