On 2/10/06, Jeremy Hylton <[EMAIL PROTECTED]> wrote: > It looks like a solution may be to define it as "const char * const *" > rather than "const char **". I'll see if that works.
No. It doesn't work. I'm not sure about this one either, but some searching suggests that you can pass a char** to a function taking const char* const* in C++ but not in C. Sigh. I don't see any way to avoid a warning in Jack's case. Jeremy > > Jeremy > > On 2/10/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Jeremy Hylton wrote: > > > I admit that I'm also puzzled by Jack's specific question. I don't > > > understand why an array passed to PyArg_ParseTupleAndKeywords() would > > > need to be declared as const. I observed the problem in my initial > > > changes but didn't think very hard about the cause of the problem. > > > Perhaps someone with better C/C++ standards chops can explain. > > > > Please take a look at this code: > > > > void foo(const char** x, const char*s) > > { > > x[0] = s; > > } > > > > void bar() > > { > > char *kwds[] = {0}; > > const char *s = "Text"; > > foo(kwds, s); > > kwds[0][0] = 't'; > > } > > > > If it was correct, you would be able to modify the const char > > array in the string literal, without any compiler errors. The > > assignment > > > > x[0] = s; > > > > is kosher, because you are putting a const char* into a > > const char* array, and the assigment > > > > kwds[0][0] = 't'; > > > > is ok, because you are modifying a char array. So the place > > where it has to fail is the passing of the pointer-pointer. > > > > Regards, > > Martin > > > _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com