Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Using VARARG in Macros
 ◄Example►                                   ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
 
     See also: Using VARARG in Procedures, MACRO, FOR
 
     The VARARG attribute allows you to pass a variable number of
     arguments to a macro. The macro parameter will be passed a
     comma-separated list of values (or a blank if no values are given)
     when called. You can apply the VARARG attribute only to the last
     parameter in a macro definition.
 
     You can use the FOR directive to handle macro parameters with the
     VARARG attribute. The following macro function calculates the
     number of arguments in a VARARG parameter:
 
       @ArgCount MACRO parmlist:VARARG
           LOCAL count
           count = 0
           FOR parm, <parmlist>
               count = count + 1               ; Count the parameters
           ENDM
           EXITM count
       ENDM
 
     This example button links to a macro that allows you to access an
     argument by its number.
                                    -♦-