Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Type of udata in kevent



On Sun, Nov 11, 2012 at 08:41:43AM +0000, Sad Clouds wrote:
> 
> Anyway intptr_t type is not "a pointer to int", but a signed data type
> which is at least as big as a void *. This means you can store void *
> in intptr_t safely AND you can do signed integer comparison on this
> type.

At a guess you are only allowed cast 'void *' to 'intptr_t' and
then cast it back (and then back to the original type).
Clearly you can compare the intptr_t values - but I doubt that is
required to have any relation to the equivalent comparisons of the
original pointers (apart from equality).

> So depending on computer architecture, intptr_t will be defined
> as int, or long.

It need not be either, it can be another intergral type entirely.
In particular 'long' isn't guaranteed to be big enough (and isn't
on some well known implementations).

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index