[OpenSmalltalk/opensmalltalk-vm] 931559: Replace another (UINT) cast by (usqIntptr_t) for L...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[OpenSmalltalk/opensmalltalk-vm] 931559: Replace another (UINT) cast by (usqIntptr_t) for L...

Eliot Miranda-3
 
  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 931559445c72d9a53541289330ddb5157c94daf5
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/931559445c72d9a53541289330ddb5157c94daf5
  Author: Nicolas Cellier <[hidden email]>
  Date:   2016-07-08 (Fri, 08 Jul 2016)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  Replace another (UINT) cast by (usqIntptr_t) for LLP64 compatibility

(UINT) would not work on LP64 anyway, it would truncate the pointer.


Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] 931559: Replace another (UINT) cast by (usqIntptr_t) for L...

Henrik Sperre Johansen
Reading https://msdn.microsoft.com/en-us/library/windows/desktop/bb773352(v=vs.85).aspx
Wouldn't either way work?
The struct field is a UINT ID number, not a pointer, so truncating the pointer to use as id would be as good as putting a 64bit pointer in the struct, and then overwriting the last bits by subsequently setting uFlags, as long as they both consistently yield the same value in uID field based on hInstance.
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] 931559: Replace another (UINT) cast by (usqIntptr_t) for L...

Ben Coman
In reply to this post by Eliot Miranda-3
 
On Fri, Jul 8, 2016 at 5:44 PM, GitHub <[hidden email]> wrote:

>
>   Branch: refs/heads/Cog
>   Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
>   Commit: 931559445c72d9a53541289330ddb5157c94daf5
>       https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/931559445c72d9a53541289330ddb5157c94daf5
>   Author: Nicolas Cellier <[hidden email]>
>   Date:   2016-07-08 (Fri, 08 Jul 2016)
>
>   Changed paths:
>     M platforms/win32/vm/sqWin32Main.c
>
>   Log Message:
>   -----------
>   Replace another (UINT) cast by (usqIntptr_t) for LLP64 compatibility

Just curious, why not put the "sq" at the front?
It would seem to better categorise application specific types.
cheers -ben

>
> (UINT) would not work on LP64 anyway, it would truncate the pointer.
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] 931559: Replace another (UINT) cast by (usqIntptr_t) for L...

Nicolas Cellier
In reply to this post by Henrik Sperre Johansen
 
Yes, maybe it would have worked, I don't know.
Analyzing if this warning is a true or false positive is costly and it's hard to store the result of the query.
The best thing to do is to just eliminate the warning by providing compatible types.

2016-07-08 14:46 GMT+02:00 Henrik Sperre Johansen <[hidden email]>:

Reading
https://msdn.microsoft.com/en-us/library/windows/desktop/bb773352(v=vs.85).aspx
Wouldn't either way work?
The struct field is a UINT ID number, not a pointer, so truncating the
pointer to use as id would be as good as putting a 64bit pointer in the
struct, and then overwriting the last bits by subsequently setting uFlags,
as long as they both consistently yield the same value in uID field based on
hInstance.




--
View this message in context: http://forum.world.st/OpenSmalltalk-opensmalltalk-vm-931559-Replace-another-UINT-cast-by-usqIntptr-t-for-L-tp4905547p4905579.html
Sent from the Squeak VM mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] 931559: Replace another (UINT) cast by (usqIntptr_t) for L...

Nicolas Cellier
In reply to this post by Ben Coman
 


2016-07-08 16:27 GMT+02:00 Ben Coman <[hidden email]>:

On Fri, Jul 8, 2016 at 5:44 PM, GitHub <[hidden email]> wrote:
>
>   Branch: refs/heads/Cog
>   Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
>   Commit: 931559445c72d9a53541289330ddb5157c94daf5
>       https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/931559445c72d9a53541289330ddb5157c94daf5
>   Author: Nicolas Cellier <[hidden email]>
>   Date:   2016-07-08 (Fri, 08 Jul 2016)
>
>   Changed paths:
>     M platforms/win32/vm/sqWin32Main.c
>
>   Log Message:
>   -----------
>   Replace another (UINT) cast by (usqIntptr_t) for LLP64 compatibility

Just curious, why not put the "sq" at the front?
It would seem to better categorise application specific types.
cheers -ben


I'm following existing pattern: sqInt usqInt sqLong usqLong ...
It's better both for uniformity and also because the pattern is exploited by special handling in CodeGenerator
(int types beginning with $u...)

>
> (UINT) would not work on LP64 anyway, it would truncate the pointer.
>
>
>