Cast void * to u_int

Thomas Martitz thomas.martitz@student.HTW-Berlin.de
Mon Feb 8 00:25:00 GMT 2010


On 04.02.2010 19:37, Brian McGrew wrote:
> DOH!
>
> I knew that.  Much better now!  (see what happens when you work all night
> with no sleep!)
>
> -b
>
>
> On 2/4/10 10:28 AM, "Adel Abushaev"<adel.abushaev@gmail.com>  wrote:
>
>    
>> u_int is always 32bit.
>>
>> A.
>>
>> On Thu, Feb 4, 2010 at 10:26 AM, Brian McGrew<brian@visionpro.com>  wrote:
>>      
>>> Good morning!
>>>
>>> I have a line of code as follows (excuse erroneous capitulation, it's my
>>> mailer)
>>>
>>> XtPointer client_data; // which is really void *
>>> u_int days = reinterpret_cast<u_int>(client_data);
>>>
>>> When I compile with gcc-4.1.2 I get:
>>>
>>> error: cast from 'void*' to 'u_int' looses precision
>>>
>>> This is the first time I've tried to rebuild this program with gcc-4, it was
>>> previously build with gcc-2.95.2 (really old code but it works and is
>>> simple).
>>>
>>> What am I missing here???
>>>
>>> Thanks!
>>>
>>> -b
>>>
>>>
>>>        
>    

Pointer-to-int conversion should always happen with intptr_t.



More information about the Gcc-help mailing list