[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [LCP]Incompatible Types



David Lloyd wrote:

| The definition is as follows:
| 
| /*@only@*/ poptContext poptGetContext(/*@keep@*/ const char * name,
|        int argc, /*@keep@*/ const char ** argv,
|        /*@keep@*/ const struct poptOption * options, int flags);

This declaration is wrong -- argv is not `const'.  The Standard
says:

    The parameters argc and argv and the strings pointed to by
    the argv array shall be modifiable by the program [...]

| int main(int argc, char *argv[]) {

This is a correct declaration.

| popt.c:14: warning: passing arg 3 of `poptGetContext' from
| incompatible pointer type

The diagnostic is correct, given the (incorrect) declaration in
popt.h -- but it's the header that is wrong.

Greg