[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cinvoke-dev] strtol cast in cinvoke_lua.c
From: |
Will Weisser |
Subject: |
RE: [cinvoke-dev] strtol cast in cinvoke_lua.c |
Date: |
Tue, 15 Aug 2006 10:30:03 -0500 |
It's an instance of visual studio being terrible and giving a pointless
warning that gcc doesn't give when assigning a 32bit integer to a 32bit
pointer. Unforunately, adding that cast to suppress the warning in VS
causes gcc to (correctly) warn about assigning a 64bit integer to a 32
pointer. Since that code was written I found a better way to suppress
the warning in visual studio anyway (turn off "Detect 64-bit portability
issues"). Short version: you can get rid of the cast.
-W.W.
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Shmuel Zeigerman
Sent: Tuesday, August 15, 2006 11:55 AM
To: address@hidden
Subject: [cinvoke-dev] strtol cast in cinvoke_lua.c
What's the purpose of the following conditional define
in the function 'get_ptr_val' in 'cinvoke_lua.c'?
#ifdef _WIN32
ret = (void *)(long long)strtol(pstr, &endptr, 16);
#else
ret = (void *)strtol(pstr, &endptr, 16);
#endif
a) GCC on Windows issues a warning:
[Warning] cast to pointer from integer of different size
b) I compiled on Windows without the (long long) cast,
and cinvoke_lua.dll seems to work just fine.
Am I missing something?
Thank you.
--
Shmuel
_______________________________________________
cinvoke-dev mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/cinvoke-dev