Inside function :
TCHAR TStr[100];
TCHAR *TTStr=TStr;
*1)
__asm {
mov AL,[TStr];
}
*2)
__asm{
mov AL,[TTStr];
}
*1) is works.
*2) didn't work, It's said error C2443 : operand size conflict.
why *2) doesn't works ?
Printable View
Inside function :
TCHAR TStr[100];
TCHAR *TTStr=TStr;
*1)
__asm {
mov AL,[TStr];
}
*2)
__asm{
mov AL,[TTStr];
}
*1) is works.
*2) didn't work, It's said error C2443 : operand size conflict.
why *2) doesn't works ?
I don't use assembly much, but my guess is that the issue is that 'TStr' is actually "sizeof(TCHAR)*100" bytes, and 'TTStr' is only 4 bytes (on a 32 bit machine).
However, I don't know what AL is....
Viggy
sizeof(TCHAR)==1 when compiling a non-unicode project, which means that a TCHAR contains 1 byte.
AL contains one byte.
Works, because it is equivalent to:Code:mov AL,[TSTR]
That is, it moves the first byte of the array into AL.Code:mov AL, byte ptr [(offset TStr)]
But:
requests for moving TTStr (which is a 4 bytes variable) to a one-byte register.Code:mov AL,[TTStr]
Thus, the compiler complains.
You may try something like:
In that case, the whole pointer will be copied to the EAX register.Code:mov EAX, [TTStr]
And the lowest byte is stored in AL.