Python, Linux, and the setuid bit

Grant Edwards invalid at invalid.invalid
Tue Apr 15 11:05:25 EDT 2014


On 2014-04-15, Dave Angel <davea at davea.name> wrote:

> Your variable 'size' is declared as size_t, which is an integer
> the size of a pointer.

While that may always be true in practice (at least with gcc), I don't
think the C standard requires it.  size_t is guaranteed to be unsigned
with at least 16 bits and sufficiently wide to represent the size of
any object.  It might be possible, in theory, to have an architecture
that used 64-bit pointers but restricted each data space to 32-bits
and therefore could use 32-bit values for size_t.

If you want to declare an integer the size of a pointer, then the
choices are intptr_t (signed), uintptr_t (unsigned), and ptrdiff_t
(signed value representing the difference between to pointers). 

> Not necessarily the same as an int.

Indeed.

-- 
Grant Edwards               grant.b.edwards        Yow! Is something VIOLENT
                                  at               going to happen to a
                              gmail.com            GARBAGE CAN?



More information about the Python-list mailing list