Re: will the pointer survive?

From: Unforgiven (jaapd3000_at_hotmail.com)
Date: 11/14/03


Date: Fri, 14 Nov 2003 12:34:32 +0100

Allen wrote:
> Hi all,
>
> Will my pointer survive this conversion?
>
> MyType_tag MyType;
> MyType_tag* pMyPntr = &MyType;
> int iUglyTempStorage = (int)pMyPntr;
> MyType_tag* pMyOtherPntr = (MyType_tag*)iUglyTempStorage;

Only if you're using a platform where an int is the same size as a pointer.

-- 
Unforgiven
"You can't rightfully be a scientist if you mind people thinking
you're a fool."


Relevant Pages

  • Re: Sliding window and wrap-around
    ... This works on my platform (GCC, Linux, x86) but AFAIU, conversion ... promoted to int before performing the subtraction? ...
    (comp.lang.c)
  • Re: Problem with linker
    ... but to have actually written a default constructor. ... such as overloading on int and pointer types. ... conversion of 0 to CString requires a user-defined conversion, ... acceleration operator *(distance d, time_squared t2); ...
    (microsoft.public.vc.mfc)
  • Re: Interesting list Validity (True/False)
    ... TypeError: int argument required ... If the gmpy writers are not allowing the conversion, ... it raises an OverflowError and the "%d" formatting ...
    (comp.lang.python)
  • Re: if(a);
    ... The type of the octal signed int literal 0 will be compared to the ... 'a' has type unsigned int, in which case 0 is converted to ... is still 0 after undergoing conversion, ...
    (comp.lang.c)
  • Re: [PATCH 1/2] Add function to convert between calendar time and broken-down time for universal
    ... convert time between calendar time and broken-down time. ... replace `int' with `unsigned int', ... needed of your email client is performing tab-to-space conversion. ... * Library General Public License for more details. ...
    (Linux-Kernel)