[Pyrex] A riddle

Tomasz Primke tprimke at interia.pl
Tue Apr 18 21:24:05 CEST 2006


Well, I think I have finally find that *.* bug.

My friend told me, that in C the assumption

  sizeof( some struct ) == sum of sizeof( all struct's attributes )

is not always met. The sum of struct's attributes sizes must be rounded up 
to 4. So I changed the "size" C function code to:

cdef ULI size( ULI pointers, ULI ulis, ULI usis, ULI ints, ULI doubles ):
  cdef ULI s
  s = ... # calculate the sum of all attributes' sizes
  while s % 4 != 0:
    s = s + 1
  return s

and all works fine now.


Well, that's what can happen, when a (very) high-level Python man lowers his 
scope to low-level world of C and memory managment done by PC machines...


Best regards,

	Tomek



More information about the Pyrex mailing list