[Pyrex] Questions about forward declarations

Greg Ewing greg at cosc.canterbury.ac.nz
Wed May 28 02:20:25 CEST 2003


"Edward C. Jones" <edcjones at erols.com>:

> What are the Pyrex rules about multiple declarations, incomplete
> declarations, forward declarations, etc?

Currently, all incomplete declarations of structs/sequences/
enums/extension types must occur *before* the complete
declaration. There's a bug at the moment which causes an incomplete
declaration following a complete one to wipe out the complete one.

I intend to fix this at some point, but in the meantime you'll just
have to arrange for all your incomplete declarations to appear first
somehow. For example, you could generate two streams of output, one
for the forward declarations and one for everything else, and then put
them together afterwards.

> In Python forward declarations are not needed. Should Pyrex be like C
> or like Python?

Pyrex doesn't need them for variables or functions. Currently it does
need them for types, because all the type analysis for a given scope
is done together in one pass. This might change one day, but I don't
have any immediate plans to do so. Once the aforementioned bug is
fixed, it shouldn't be so much of a problem.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list