Hi,
Neal Becker wrote:
> Stefan Behnel wrote:
>> Martin C. Martin wrote:
>>> Stefan Behnel wrote:
>>>> Well, in most cases macros are rather short code snippets, not function
>>>> replacing code blocks. So I don't care about their symbols.
>>> That's surprising to me. Don't you think you'd want to step through
>>> even short snippets in a debugger? To have them show up as a separate
>>> item in a profile, rather than spread around all the places that call
>>> them? Same with memory leaks or corruption?
>> Again: there are valid use cases for macros. They are mostly for speed,
>> not for improved debugability.
>>
>
> I don't see this argument. There is no speed advantage of macros over
> inline, providing your compiler supports inline. Maybe you're talking
> about C compilers that don't support inline?
Maybe a different example would help. How would you write this in Cython:
// --- FILE defs.h
#define PY_NEW(T) \
(((PyTypeObject*)(T))->tp_new( \
(PyTypeObject*)(T), __pyx_empty_tuple, NULL))
# --- FILE some.pyx
cdef extern from "defs.h":
# macro call to 't->tp_new()' for fast instantiation
cdef DTD NEW_DTD "PY_NEW" (object t)
dtd = NEW_DTD(DTD)
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev