flat assembler
Message board for the users of flat assembler.
Index
> Main > macro duplicated args no error message, |
Author |
|
LocoDelAssembly 17 Jun 2007, 01:39
[edit]Save your time skipping this senseless post and continue reading from the post below this one.[/edit]
Why do you think it is wrong?? "mov eax, eax" is perfectly valid (even though it just do nothing). However are other instructions where using the same operand has effect, for example sub and xor which has the effect of clearing the operand and add which has the effect of multiply the operand by two. Obviously there are others but I think that those are enough examples If you want to trap when both operands are the same check http://flatassembler.net/docs.php?article=manual#2.2.2 (the "eq" operator) Last edited by LocoDelAssembly on 17 Jun 2007, 15:38; edited 1 time in total |
|||
17 Jun 2007, 01:39 |
|
revolution 17 Jun 2007, 12:37
What happens if you do this:?
Code: macro xyz a,a { mov a, a } xyz eax, ebx |
|||
17 Jun 2007, 12:37 |
|
LocoDelAssembly 17 Jun 2007, 15:36
I never realized that he means that the formal parameters names are the same
With that code it produces "mov ebx, ebx" so it uses the rightmost value. If you only supply one actual parameter then it tries to assemble "mov ," because the last value of a was void. Sorry for my very silly post above |
|||
17 Jun 2007, 15:36 |
|
vid 17 Jun 2007, 17:48
i think i even mentioned this in my old preprocessor tutorial
|
|||
17 Jun 2007, 17:48 |
|
lazer1 17 Jun 2007, 20:02
revolution wrote: What happens if you do this:? that is a better example of the problem, I had a header file with many macros, and my code kept echoing 0 when it was supposed to echo nonzero, after much debugging I realised the problem must be in the macro, careful scrutiny revealed that arg 3 and arg 6 of a 6 arg macro had the same name, if you arent thinking about this specific problem then you might not notice it in a macro with many args. so I think fasm needs to regard this as an error, duplicated arg names serves no purpose: no point having an arg you cannot reference eg in your example above the "ebx" cannot be referenced to so it must be an error condition, |
|||
17 Jun 2007, 20:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.