Question of Ignorance
Wayne Throop
throopw at rtp47.UUCP
Tue May 14 03:27:58 AEST 1985
In article <5590 at utzoo.UUCP> henry at utzoo.UUCP (Henry Spencer) writes:
>> ... I recommend using one of the two constructs
>>
>> ( longptr == (long *)32 )
>> or ( (int)longptr == 32 )
>>
>> which are guaranteed to do what you want ...
>
>Argh, WRONG!! Turn that "(int)" into "(long)" and I might agree. You
>have no guarantees that an int is long enough to hold a pointer.
I'm not sure what ANSI C says about pointers fitting into longs, but I
don't think there is any guarantee there either. If there IS such a
guarantee, It doesn't seem like a good idea, since I know of
machines upon which pointers don't even fit in longs. Of course,
pointers would have a better *chance* of fitting into a long :-).
--
Wayne Throop at Data General, RTP, NC
<the-known-world>!mcnc!rti-sel!rtp47!throopw
More information about the Comp.lang.c
mailing list