News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Bug in macro code "if var eq 0"?

Started by Igor, April 03, 2009, 03:36:59 PM

Previous topic - Next topic

Igor

Am i doing something wrong here:

macro:
test_macro macro vr1
if vr1 eq 0
xor ecx, ecx
else
mov rcx, vr1
endif
endm


this code:
test_macro FALSE ; 0
test_macro TRUE ; 1
test_macro WS_EX_CLIENTEDGE ; 200h
test_macro WS_EX_CONTROLPARENT ; 10000h
test_macro WS_EX_CLIENTEDGE or WS_EX_CONTROLPARENT ; 10200h

is assembled like this:
xor         ecx,ecx
mov         rcx,1
mov         rcx,200h
mov         rcx,10000h
xor         ecx,ecx ; WTF???


He thinks it is equal to zero every time i put "or", how to resolve this?

qWord

hi,

this is not a bug. masm replace vr1 by "WS_EX_CLIENTEDGE or WS_EX_CONTROLPARENT" and this is treated as: "if WS_EX_CLIENTEDGE  OR  ( WS_EX_CONTROLPARENT eq 0)".

change "if vr1 eq 0" to  "if (vr1) eq 0"

regards, qWord
FPU in a trice: SmplMath
It's that simple!

Igor

Ahhh, didn't know that, thank you. It works now.