flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
quiveror
The following expressions don't seem to be correctly generated (as now for 1.66). Please try them out.
1. ~ax & bx 2. ~(ax | bx) 3. ax&bx | cx&dx cheers, |
|||
![]() |
|
vid
can you give examples of cases where it doesn't work?
|
|||
![]() |
|
Tomasz Grysztar
As for the "ax&bx | cx&dx", note that in fasm (I mean the regular IF), the & and | operators have exactly the same precedence, so they are executed simply from left to right (just like multiplication and division, or addition and substraction). Those macros reproduce the same behavior here, too. Thus
Code: .if ax & bx | cx & dx is equivalent to: Code: .if ( (ax & bx) | cx ) & dx and generated code is correct in this case. |
|||
![]() |
|
quiveror
IMHO, the & should have higher precedence than |. This would be great because it would conform to the C language (and many others) defacto standard and a bit easier for newcomers to get used to fasm too.
Anyway, I've been using fasm for quite a while but never notice this. The fact surprises me indeed ![]() |
|||
![]() |
|
Tomasz Grysztar
I made it this way because for my own understanding it's more natural than the "defacto standard". You should anyway always use square brackets if you're not sure how it would be interpreted.
|
|||
![]() |
|
Aster!x
But if there are no brackets the interpreter should follow the C standard, i think
|
|||
![]() |
|
okasvi
why should assembler follow C standard?
![]() and anyway it's just a macro, anyone not liking it can make a new one |: |
|||
![]() |
|
Tomasz Grysztar
It's just a macro, but it reproduces the same operators precedence that fasm uses internally (for assembler-processed IF conditions).
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.