News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

IFDEF

Started by mabdelouahab, November 18, 2013, 04:51:09 AM

Previous topic - Next topic

mabdelouahab

hi
How do I use IFDEF, to make sure of the definition of the Member in Struct

F EX:

If I used: R :RECT
IFDEF R.left  <======result  Ok Def
And also
IFDEF R.Alfa22l  <======result Ok Def

IFDEF RECT.left  <======result  Ok Def
And also
IFDEF RECT.Alfa22l  <======result Ok Def



qWord

[ELSE]IF[N]DEF only checks if the label R exists. The OPATTR operator can be used to validate the expression:
IF opattr R.Alfa22l
    echo dead code
ENDIF
IF opattr R.left
    echo R.left
ENDIF
IF opattr RECT.foo
    echo dead code
ENDIF
IF opattr RECT.right
    echo RECT.right
ENDIF
MREAL macros - when you need floating point arithmetic while assembling!

mabdelouahab


jj2007

Quote from: qWord on November 18, 2013, 05:30:13 AM
The OPATTR operator can be used to validate the expression

Beware of little problems with JWasm:
include \masm32\include\masm32rt.inc

.code

start:
R RECT <?>

tmp$ CATSTR <The_arg=>, <R.Alfa22l>, < with opa=>, %(opattr R.Alfa22l)
% echo tmp$

tmp$ CATSTR <The_arg=>, <R.left>, < with opa=>, %(opattr R.left)
% echo tmp$

tmp$ CATSTR <The_arg=>, <RECT.foo>, < with opa=>, %(opattr RECT.foo)
% echo tmp$

tmp$ CATSTR <The_arg=>, <RECT.right>, < with opa=>, %(opattr RECT.right)
% echo tmp$

.err
exit

end start

OPT_Assembler JWasm

JWasm:
The_arg=R.Alfa22l with opa=[b]768[/b]
The_arg=R.left with opa=[b]810[/b]
The_arg=RECT.foo with opa=0
The_arg=RECT.right with opa=36

ML 6.14 ... 10.0:
The_arg=R.Alfa22l with opa=0
The_arg=R.left with opa=42
The_arg=RECT.foo with opa=0
The_arg=RECT.right with opa=36


P.S.: I thought of posting a bug report but I see you did it already ;-)