Copyright (C) 2000-2012 |
GNU Info (nasm.info)Section 4.3.14.3.1. Overloading Multi-Line Macros ------------------------------------ As with single-line macros, multi-line macros can be overloaded by defining the same macro name several times with different numbers of parameters. This time, no exception is made for macros with no parameters at all. So you could define %macro prologue 0 push ebp mov ebp,esp %endmacro to define an alternative form of the function prologue which allocates no local stack space. Sometimes, however, you might want to `overload' a machine instruction; for example, you might want to define %macro push 2 push %1 push %2 %endmacro so that you could code push ebx ; this line is not a macro call push eax,ecx ; but this one is Ordinarily, NASM will give a warning for the first of the above two lines, since `push' is now defined to be a macro, and is being invoked with a number of parameters for which no definition has been given. The correct code will still be generated, but the assembler will give a warning. This warning can be disabled by the use of the `-w-macro-params' command- line option (see *Note Section 2.1.18::). automatically generated by info2www version 1.2.2.9 |