News:

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

Main Menu

offsetof MACRO

Started by habran, June 30, 2014, 05:29:19 PM

Previous topic - Next topic

jj2007

Quote from: hutch-- on July 01, 2014, 04:08:48 PM
> The trick with macros is to get around MASM's bugs

We generally call them undocumented features.  :icon_mrgreen:

Hutch, these features are all documented now.

hutch--

 :biggrin:

> Hutch, these features are all documented now.

Nah, this is just propaganda from the competition.

What makes me laugh is MASM was always a bad mannered old pig, that's part of its charm. Its task is to screw mnemonics together, not to hold the hand of the timid. You learn its "features" the hard way like normal and manipulate them to do the task you want. Now the ancient macro engine is an even bigger old pig with notation that was out of date in 1988 but interestingly enough if you massage it hard enough, you get results.

qWord

Quote from: hutch-- on July 01, 2014, 11:16:31 PMNow the ancient macro engine is an even bigger old pig with notation that was out of date in 1988 but interestingly enough if you massage it hard enough, you get results.
:P

Still one of my favorites:
foo macro
echo did you see me?
EXITM <0>
endm

% ; foo()
Undocumented feature "expand macro function and discard return value"  :biggrin:
MREAL macros - when you need floating point arithmetic while assembling!

jj2007

Quote from: qWord on July 01, 2014, 11:32:35 PM
% ; foo()
Undocumented feature "expand macro function and discard return value"  :biggrin:

Similar (but quite useful):

include \masm32\include\masm32rt.inc

void MACRO args
  @CatStr(<;>, <args>)
ENDM

.code
start:
  void rv(MessageBox, 0, "Hello World", "It's all void:", MB_OK)

  exit
end start