[Cython] removing ALL those nasty warnings about string constants
Stefan Behnel
stefan_ml at behnel.de
Fri Dec 19 21:39:46 CET 2008
Lisandro Dalcin wrote:
> On Fri, Dec 19, 2008 at 5:24 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>> Robert Bradshaw wrote:
>>> I'm all for suppressing warnings as long as you are sure they are not
>>> real ones, and it doesn't make the code too verbose. I assume it's a
>>> lot of changes like
>>>
>>> SomePyCAPI(%s) to SomePyCAPI((char*)%s)
>>>
>>> ?
>> Then I'd prefer using a macro like
>>
>> #define CHARPTR (char*)
>>
>> so that we can redefine it to nothing in Py3 where it's not needed (if I
>> understood correctly).
>
> Yes, the only problem is that it should be better to use
> __Pyx_CHARP("abc") ... Let's avoid possible colisions in the
> preprocessor/compiler namespace....
>
> In short, I'm thinking on implementing like this
>
> #if Py2
> #define __Pyx_CHARP(p) ((char*)(p))
> #else
> #define __Pyx_CHARP(p) (p)
> #endif
>
>
> What do you think?
Fine with me. Whatever you take, the hardest part is to put it where it
belongs. Changing the name later on is a simple search&replace.
Stefan
More information about the Cython-dev
mailing list