Re: Is an unsigned integer big enough to store a void *?
- From: "Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx>
- Date: Thu, 15 Dec 2005 20:48:08 -0700
Under Win32, any type of int is the same size as a pointer. I believe that
is also the case under Win64 as well.
--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm
"Tony Young" <jdt_young@xxxxxxxxx> wrote in message
news:ueVGFCfAGHA.3984@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> If I use an unsigned integer to store a void pointer, is the unsigned
> integer big enough to store the void pointer? That is, is it possible for
> some cases that truncation or information loss is possible?
>
> void* p;
> ....
> unsigned int d = (unsigned int) p;
> ASSERT(d == p);
>
> The reason I ask is that I need to pass a void * to a library function
> that takes an unsigned integer. Later the function returns it back to me.
> I wonder if the two values (in and out) will be exactly the same.
>
> Please advise. Thanks.
>
> Tony
.
- Follow-Ups:
- Re: Is an unsigned integer big enough to store a void *?
- From: David Wilkinson
- Re: Is an unsigned integer big enough to store a void *?
- References:
- Is an unsigned integer big enough to store a void *?
- From: Tony Young
- Is an unsigned integer big enough to store a void *?
- Prev by Date: Is an unsigned integer big enough to store a void *?
- Next by Date: Re: Super Dynamic 2D Array
- Previous by thread: Is an unsigned integer big enough to store a void *?
- Next by thread: Re: Is an unsigned integer big enough to store a void *?
- Index(es):
Relevant Pages
|