Pelles C > Bug reports
Incorrect parameter assignment
(1/1)
Vortex:
Trying to implement an enum macro :
--- Code: ---include enumMacro.inc
; enum macro by mabdelouahab
; https://masm32.com/board/index.php?msg=126825
enum MACRO __vargs:VARARG
LOCAL val__
val__=0
FOR __varg,<__vargs>
__varg EQU val__
val__ = val__ +1
ENDM
ENDM
.data
format db 'test1 = %u',13,10
db 'sample = %u',13,10
db 'experiment = %u',0
.data?
buffer db 64 dup(?)
.code
start:
enum test1,sample,experiment
invoke wsprintf,ADDR buffer,\
ADDR format,test1,sample,experiment
invoke StdOut,ADDR buffer
invoke ExitProcess,0
END start
--- End code ---
Running the executable, I receive the following results :
--- Code: ---test1 = 3
sample = 3
experiment = 3
--- End code ---
The correct version should be :
--- Code: ---test1 = 0
sample = 1
experiment = 2
--- End code ---
Poasm does not correctly assign the parameters.
Vortex:
Same result after this attempt :
--- Code: ---enum MACRO p1,p2,p3,p4,p5,p6,p7,p8
LOCAL val__
val__=0
FOR arg,<p1,p2,p3,p4,p5,p6,p7,p8>
IFNB <arg>
arg EQU val__
val__ = val__ +1
ENDIF
ENDM
ENDM
--- End code ---
--- Code: ---test1 = 3
sample = 3
experiment = 3
--- End code ---
Navigation
[0] Message Index
Go to full version