[Pyrex] Pyrex and C++
Michael JasonSmith
mpj17 at student.canterbury.ac.nz
Mon Nov 17 02:46:37 CET 2003
On Sat, 2003-11-15 at 18:51, David J. C. Beach wrote:
> [snip]
> , it seems that there are three categories of error that cause the C++
> compiler to complain about the pyrexc produced code:
>
> 1) Assignment to "non l-values"
> 2) Redeclaration of variables
> 3) Assigning to non-void pointers from void* values
>
> I don't yet fully understand the details of #1
An l-value is the variable on the left-hand sign of an assignment.
Something like "foo" in the assignment
foo = bar + 3;
C (well, gcc...) allows you to assign to a "non l-value", as so
foo - 3 = bar;
Normally you do this to make mathematical expressions easier (or harder)
to understand. (I recently had call to try this in Python, and was
disappointed when it didn't work :( )
Talking to Greg, the problem with Pyrex appears to be with the code that
generates the casts, with the casts appearing on the wrong side of the
assignment. For example
(wibble *) blarg = py_spam_parrot(foo, bar);
This is legal in C, but not in C++. For C++ to be happy the code would
have to read something along the lines of
blarg = (wibble *) py_spam_parrot(foo, bar);
I have never coded in C++ so I cannot assist beyond this point, but I
hope this helps\ldots
--
Michael JasonSmith http://www.ldots.org/
More information about the Pyrex
mailing list