c - How can we shift ob_item pointer in Python tuple if it is static array? -
i reading python 2.7 source code , got stuck following piece of code, in tupleobject.h
:
pyobject *ob_item[1];
and in tupleobject.c
(pytuple_setitem
):
p = ((pytupleobject *)op)->ob_item + i;
how can shift pointer i
if ob_item
array of 1 pyobject
?
it's how arrays , pointers can used interchangeable. it's equivalent to
p = &((pytupleobject *)op)->ob_item[i];
is array name pointer? goes little more detail.
Comments
Post a Comment