Joined: 16 Jun 2003
But eax has 32 bits and I'm generating 32 bit code. The operation can only be 32 bits, so why demand the use of 'dword'?
Because the compiler is not sure you really want to write 32bit register to 64bit variable. You could misspell the names of similar named variables, for example. Or you redefined the variable from 32 to 64 bit and then forgot to change the mov instruction from eax to rax.
That would be exactly my answer. The point is not what kind of code (16-, 32- or 64-bit) you write. The point is how you declare your variables. Declarations indicate what kind of variable you have and if that kind does not match the operation you try to apply to it, then the compiler complains. That the compiler "is not sure" is not correct in this case. It's quite sure that you're using a wrong operation unless you forcefully make it shut up with a size override operator. For that reason the change in the declaration is a much better idea as it needs no enforcement and allows the compiler to perform the size check.
_________________ Faith is a superposition of knowledge and fallacy
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum