It looks like a solution may be to define it as "const char * const *" rather than "const char **". I'll see if that works. Jeremy On 2/10/06, "Martin v. Löwis" <martin at v.loewis.de> 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 >
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4