__Fb_Arg_Listexpand__
Intrinsic define (macro) performed by the compiler.
Syntax
`
__FB_ARG_LISTEXPAND__( macroname, macroargcount, args... )
`
Parameters
`macroname`
name of the macro used for extension calls
`macroargcount`
number of parameters for the 'macroname' macro
expand the parameter list 'args...' according to the 'macroargcount' value:
- 'macroargcount > 0' : pass 'macroargcount' parameters each time
- 'macroargcount = 0' : pass all parameters
- 'macroargcount < 0' : for each parameter passed, the previous 'macroargcount' parameters are automatically removed on the next pass
`args...`
argument list
Description
Expands to one or more 'macroname( .... )' depending on the value of `macroargcount` and number of arguments in the `args...` list.
Returns empty string on invalid index, rather than compile error.
Example
`
#macro m( arg... )
#print " "##arg
#endmacro
#print "macroargcount>0 (=1):"
__FB_ARG_LISTEXPAND__( m, 1, Hello1, Hello2, Hello3, Hello4)
#print " "
#print "macroargcount=0 (=0):"
__FB_ARG_LISTEXPAND__( m, 0, Hello1, Hello2, Hello3, Hello4)
#print " "
#print "macroargcount<0 (=-1):"
__FB_ARG_LISTEXPAND__( m, -1, Hello1, Hello2, Hello3, Hello4)
/' Compiler output:
macroargcount>0 (=1):
Hello1
Hello2
Hello3
Hello4
macroargcount=0 (=0):
Hello1, Hello2, Hello3, Hello4
macroargcount<0 (=-1):
Hello1, Hello2, Hello3, Hello4
Hello2, Hello3, Hello4
Hello3, Hello4
Hello4
'/
`
Version

- Since fbc 1.20.0

Differences from QB

- New to FreeBASIC

See also

- `__FB_ARG_RIGHTOF__`
- `__FB_ARG_LEFTOF__`
- `__FB_ARG_COUNT__`
- `__FB_ARG_EXTRACT__`