Lisandro Dalcin wrote:
> On Wed, Oct 14, 2009 at 3:44 PM, Dag Sverre Seljebotn
> <[email protected]> wrote:
>> Lisandro Dalcin wrote:
>>> On Wed, Oct 14, 2009 at 2:26 PM, Stefan Behnel <[email protected]> wrote:
>>>> Lisandro Dalcin wrote:
>>>>> I think I'll use
>>>>> PyLong_{From|As}VoidPtr for importing/exporting the API structure...
>>>>> Making it simpler will make it also portable across all CPython
>>>>> versions.
>>>> But it wouldn't make it compatible with other non-Cython C-APIs, would it?
>>>> I think that's a requirement. If there's a standard way, Cython should be
>>>> 100% compatible with that.
>>>>
>>> Please note I was talking JUST about the refnanny support module. The
>>> import/export of its C-API (actually a pointer to a struct) what
>>> rather ad-hoc and used PyCObject... I do not really see the point of
>>> bothering about the refnanny module "properly" exporting its API and
>>> complicating the implementation now that CObjects are not available in
>>> all Python runtimes.
>>>
>>>>> Additionally, I'll make a heavy renaming of some refnanny stuff,
>>>>> things will be now named "__Pyx_RefNanny[XXX]".
>>>> What's that for?
>>>>
>>> Just for the sake of the generated C code being more easier to follow
>>> and understand... We always talk about "refnanny", why not generate
>>> the C code using that name consistently where appropriate.
>>> Additionally, I'm changing the way of using the CYTHON_REFNANNY macro
>>> with the preprocessor... Now you have to explicitly #define it to 1,
>>> (as we require for complex support, and C-level profiling) ...
>> I'd say it is the complex support and profiling who's got it wrong and
>> CYTHON_REFNANNY that's got it right. Being able to do "-DOPTION" and use
>> #ifdef is *very* common.
>>
> 
> Well, we can discuss about that, but #if MACRO ... #endif is also
> common... And suppose someone does -DMACRO=0 ...
> 
> Moreover, paste this in some file in tmp.c
> 
> #if ABC
> #warning ABC is true
> #else
> #warning ABC is false
> #endif
> 
> #ifdef XYZ
> #warning XYZ is defined
> #else
> #warning XYZ is not def
> #endif
> 
> int main(int a, char**b){}
> 
> and next compile like this:
> 
> $ gcc -DABC -DXYZ=0 cmacro.c
> 
> I get this output:
> 
> cmacro.c:3:2: warning: #warning ABC is true
> cmacro.c:9:2: warning: #warning XYZ is defined
> 
> So it seems that (at least with GCC) your bare -DFOO way still does
> the right thing, while my counter example #ifdef FOO...#endif with
> -DFOO=0 gives unexpected results...
> 
> So IMO my proposed change should go in.

OK I'm +1 now.

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to