[Python-checkins] r46240 - python/trunk/Modules/_struct.c

Tim Peters tim.peters at gmail.com
Sun May 28 04:52:15 CEST 2006


[Neal Norwitz]
> All occurrences of *p & 0xFF where p is a char* should use Py_CHARMASK().

Better is to declare p as "unsigned char *" to begin with -- then no
tricks are needed.  We have the Py_CHARMASK() irritation because
public API functions were originallly defined as taking plain "char *"
arguments, leaving it ambiguous for no real reason (and possibly under
the seemingly sane expectation that no compiler would decide to that
the unqualified char type was signed -- heh).  The functions in
_struct.c are private to that module, so are free to declare what they
intend without the backward compatibility headaches public API
functions suffer.


More information about the Python-checkins mailing list