[pypy-dev] [pypy-svn] r45269 - in pypy/dist/pypy/rpython/module: . tes

Armin Rigo arigo at tunes.org
Tue Jul 24 18:08:22 CEST 2007


Hi Fijal,

On Mon, Jul 23, 2007 at 02:38:32PM +0200, Maciek Fijalkowski wrote:
>        The length of the arrays in a struct utsname is unspecified; the 
> fields
>        are terminated by a null byte (?????? ???).
> 
> I'm completely confused.

It means that the structure looks like this in lltype notation:

      Struct('utsname', ('text1', FixedSizeArray(Char, 10)),
                        ('text2', FixedSizeArray(Char, 20)),
                        ...)

where, annoyingly, the numbers '10' and '20' are platform-dependent and
must be obtained by trying to compile snippets of C code using sizeof()
and offsetof().

Or are you confused about the bit saying that the fields are
zero-terminated?  It just means that in the array, characters 0 to N-1
are non-null, charater N is null, and the rest of the characters are
undefined.


A bientot,

Armin.



More information about the Pypy-dev mailing list