On Apr 11, 2008, at 3:53 PM, Lisandro Dalcin wrote: > Whats the rationale of the following being illegal in Cython? > > cdef extern from "bar.h": > void foo(void)
This is only because foo() is the way to specify a function with no arguments in Python. it is more useful to think of Cython as Python (+ some static declarations) than to try and think of it as being a syntactically-different variant of C. > If I'm not wrong, in a C context (but not C++), the declarations > > void foo(void); > void foo(); > > are not equivalent, the second is actually means something like > > void foo(...) It's even worse, it means "I'm just to lazy to tell you what the arguments are, but if you use the wrong ones bad things could happen." IIRC it's only around for historical reasons and officially discouraged by ANSI C, and it would be bad (in my opinion) to allow such archaic and confusing notions into Cython. > Anyway, as void foo(void) is a valid C (C++?) function declaration, I > would ask for that form being legal in Cython, unless there is a some > technical issue like leading to an ambiguous grammar. If we allow foo() and foo(void) in Cython then people might wonder if the two have different meanings (as they do in C), and such a declaration might look confusing to a Python developer. On the other hand, it will make it easier to do copy-pasting from header files (which will eventually, I hope, could be automated in many cases). - Robert _______________________________________________ Cython-dev mailing list Cython-dev@codespeak.net http://codespeak.net/mailman/listinfo/cython-dev