Most of my coding has been on 32 bit Windows and there has been this subconscious assumption I’ve always made that I could safely cast any pointer to a DWORD. I gotta change that now I guess though it’s tough to stop assuming my subconscious assumptions cause they are – well, subconscious assumptions (bad joke – yeah I know, I know, but I am in that sorta mood).
Luckily, if you turn on the /Wp64 compiler option, you’ll get a C4311 compiler warning if you attempt to do that. If you only intend to run your 32-bit programs in a 64-bit OS that supports 32-bit compatibility mode this is okay I guess, but if you want to take your code and recompile it using a 64-bit compiler in the near future, then it’d be best to turn on this /Wp64 option for all your current projects.
Uhm, I might add that I am talking about the VC++ compiler (version 7.1+) here before some GCC-lover starts abusing me of giving him misleading information π
BTW, the correct cast is now
(DWORD_PTR)πI wish MS had named their 32/64-bit compatible types something else, because I forsee newbies thinking “DWORD_PTR” is a typedef for “DWORD*” π¦
Seriously an AMD64 box is just what you need now. Get the new Windows x64 edition (RC2 is out) and you are all set to go! A decent machine is around ~1k.
/Wp64 very useful key. Unfortunately not all errors can be found with its help. If you wish to receive representations about other problems on 64-bit systems visit:
http://www.viva64.com/articles.php
Useful addition to /Wp64 can become the analysis of a code by means of static analyzers. I recommend use Viva64 (is specially created for these purposes).
http://www.viva64.com/download.php