[Solved] Assigning value to LPVOID


Besides the bad idea of randomly assigning an integer and trying use that value a LPVOID, what it is probably happening is:

  • Either, you are not compiling to a 64-bit system (as molbdnilo mentioned it in a comment) and therefore assigning a value greater than 32-bit to a 32-bit variable triggers an undefined behavior in the compiler. Try using a smaller value like 20, and see if the variable is still 0. Basically in these cases the compiler can do whatever it wants even assigning it to 0xDEADBEEF if it wants to: http://en.wikipedia.org/wiki/Undefined_behavior
  • Or, you are not using the variable, and therefore the compiler is optimizing it out (the rationale would be: why would the computer loose time assigning a value to a memory location if you are not going to use it?)

1

solved Assigning value to LPVOID