GNU Info

Info Node: (nasm.info)Section 4.3.2

(nasm.info)Section 4.3.2


Next: Section 4.3.3 Prev: Section 4.3.1 Up: Section 4.3
Enter node , (file) or (file)node

4.3.2. Macro-Local Labels
-------------------------

   NASM allows you to define labels within a multi-line macro
definition in such a way as to make them local to the macro call: so
calling the same macro multiple times will use a different label each
time. You do this by prefixing `%%' to the label name. So you can
invent an instruction which executes a `RET' if the `Z' flag is set by
doing this:

     %macro  retz 0
     
             jnz     %%skip
             ret
         %%skip:
     
     %endmacro

   You can call this macro as many times as you want, and every time
you call it NASM will make up a different `real' name to substitute for
the label `%%skip'. The names NASM invents are of the form
`..@2345.skip', where the number 2345 changes with every macro call.
The `..@' prefix prevents macro-local labels from interfering with the
local label mechanism, as described in *Note Section 3.9::. You should
avoid defining your own labels in this form (the `..@' prefix, then a
number, then another period) in case they interfere with macro-local
labels.


automatically generated by info2www version 1.2.2.9