Author Topic: Macro on the same line as a label  (Read 420 times)

sinsi

  • Member
  • *****
  • Posts: 1066
Macro on the same line as a label
« on: March 20, 2018, 09:40:07 PM »
Just spent a bit of time tracking down a problem (masm bug?)
Code: [Select]
start:  mov esi,rv(GetModuleHandle,0) is assembled as
Code: [Select]
       mov esi.eaxmissing the call to GetModuleHandle altogether.
Without the start: label it assembles correctly.

Is it a bug or am I missing something?
I can walk on water but stagger on beer.

jj2007

  • Member
  • *****
  • Posts: 8735
  • Assembler is fun ;-)
    • MasmBasic
Re: Macro on the same line as a label
« Reply #1 on: March 20, 2018, 10:52:24 PM »
It's by design :P

This concerns only macros that return something, i.e. functions. The same problem occurs e.g. with
Code: [Select]
.if eax
.elseif rv(GetModuleHandle,0)!=400000h
.else
.endif

Note that UAsm behaves exactly like MASM. AsmC, in contrast, produces a different result and is thus not MASM-compatible.

sinsi

  • Member
  • *****
  • Posts: 1066
Re: Macro on the same line as a label
« Reply #2 on: March 21, 2018, 05:54:02 PM »
Jeez, thought I would start using some macros and then this happens. Is it documented anywhere?

Quote
Note that UAsm behaves exactly like MASM. AsmC, in contrast, produces a different correct result and is thus not MASM-compatible.
I can walk on water but stagger on beer.

jj2007

  • Member
  • *****
  • Posts: 8735
  • Assembler is fun ;-)
    • MasmBasic
Re: Macro on the same line as a label
« Reply #3 on: March 21, 2018, 09:07:26 PM »
Correct? It's "by design", meaning that Micros??t will not hold your hot little hand etc etc - you know the story ;)