i had an assembly macro that i wrote that seems to compile at random. by that i mean that some places i put it will compile fine and work beautifully, and other places i put it wont compile at all. worst off all, they give really strange compiler errors.
i kept cutting things out to narrow down on the problem in one of the spots that it doesnt compile, and i ended up with this much non-compiling code:
this single, innocent line of code generates 6 compiler errors, all saying the same thing:Code:__asm mov eax, val
i can copy and paste this exact line of code to a different spot in my program and, after changing 'val' to something valid, it will happily compile.error C2400: inline assembler syntax error in 'second operand'; found 'newline'
while writing this post, i have figured out what causes the error, but i still dont understand why it does it. what i have discovered is this:
if the variable that i am putting in the register is a function argument, it wont compile. why can i not put function arguments in registers, but i can put any other type of variable in them?