[Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

Bengt Richter bokr at oz.net
Sat Feb 11 17:23:16 CET 2006

On Sat, 11 Feb 2006 14:14:00 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= <martin at v.loewis.de> wrote:

>Bengt Richter wrote:
>> Will a typedef help?
>A typedef can never help. It is always possible to reformulate
>a program using typedefs to one that doesn't use typedefs.
I realize that's true for a correct compiler, and should have
reflected that you aren't just trying to appease a particular possibly quirky one.
>Compiling your program with the const modification line
>removed gives
>martin.c: In function 'int main()':
>martin.c:18: error: invalid conversion from 'char**' to 'const char**'
>martin.c:18: error:   initializing argument 1 of 'void foo(const char**)'
Sorry, I should have tried it with gcc, which does complain:

[07:16] /c/pywk/pydev>gcc martin.c
martin.c: In function `main':
martin.c:19: warning: passing arg 1 of `foo' from incompatible pointer type

also g++, but not just warning (no a.exe generated)

[07:16] /c/pywk/pydev>g++ martin.c
martin.c: In function `int main()':
martin.c:19: invalid conversion from `char**' to `const char**'

[07:17] /c/pywk/pydev>gcc -v
<snip full specs>
gcc version 3.2.3 (mingw special 20030504-1)

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
didn't complain. But then it doesn't complain about const char** x either.
I wonder if I have complaints accidentally turned off someplace ;-/

Bengt Richter

More information about the Python-Dev mailing list