On May 20, 2009, at 5:49 AM, Dag Sverre Seljebotn wrote:
> I did some digging and decided to share what I found, since this only
> occurs on a specific compiler and is thus hard to discover.
>
> Kurt, pay attention, as I just recommended that you do this :-)
>
> Apparently code like this:
>
> (foo_struct){0, 0, NULL}
>
> is a C99 extension, so we probably shouldn't use it. Furthermore it
> makes things fail in g++ 4.2.4 (but not in earlier or later versions I
> tried -- anyway, 4.2.4 is the one currently on sage.math).
I think it's fine in C (not sure if it's just gcc), but has issues
with C++. We ran into this issue before with cdef optional arguments.
> (The reason it fails is largely due to us jumping out of the scope
> everywhere on exceptions)
>
> What I did for complex numbers was replace their use with an inline
> function returning a struct with the given values. Don't know if this
> can hit performance -- if the compiler inlines the function I wouldn't
> think it would make a difference.
Yep, this is why I did it this way (well, that and I wanted needed to
be able to provide a common interface to c99 complexes)--hopefully
it's exactly the same.
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev