[Python-Dev] Error in PEP3118?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 12 00:06:39 CET 2008


Travis Oliphant wrote:
> You could 
> argue that it would be more informative by showing the C-equivalent 
> structure as a 2-d array.  However, it would also create the possibility 
> of confusion by implying an absolute relationship between the C-compiler 
> and the type description.

Just to check on something here -- does the C standard
guarantee that

    int a[16][4];

and

    int b[64];

have the same memory layout, or is it allowed to insert
padding at the ends of the rows or something?

If they are guaranteed to have the same layout, then I'd
agree that the example is correct, but perhaps somewhat
confusing.

It might help to add a note to the effect that this
example is meant to illustrate that the descriptor doesn't
have to exactly match the C description, as long as it
describes the same memory layout.

--
Greg


More information about the Python-Dev mailing list