Revision [14861]

This is an old revision of KeyPgDots made by DkLwikki on 2010-10-12 08:37:27.

 

... (Ellipsis)


Used in place of procedure parameter to pass a variable number of arguments, or as the upper bound in an array declaration to denote that the number of elements will be determined by the initializer.

Syntax:
KeyPgDeclare declare { KeyPgSub sub | KeyPgFunction function } proc_name KeyPgCdecl cdecl ( param KeyPgAs as DataType datatype, ... )

KeyPgDim dim array_symbol ([lbound KeyPgTo to] ...) [KeyPgAs as DataType datatype] => { expression_list }

KeyPgPpdefine #define identifier( [ parameters, ] variadic_parameter... ) macro_text


Description:
The ellipsis (three dots, ...) is used in procedure declarations and definitions to indicate a variable argument list. A first argument must always be specified and the function must be called with the C calling convention KeyPgCdecl cdecl. In the procedure body, KeyPgVaFirst va_first, KeyPgVaArg va_arg and KeyPgVaNext va_next are used to handle the variable arguments.

Using an ellipsis in place of the upper bound in an array declaration causes the upper bound to be set according to the data that appears in the expression_list. When the ellipsis is used in this manner, an initializer must appear, and cannot be KeyPgAny Any.

Using an ellipsis in a KeyPgPpdefine #define or KeyPgPpmacro #macro declaration allows to create a variadic macro, see KeyPgPpdefine #define.

Examples:
Declare Function FOO CDecl (X As Integer, ...) As Integer


Examples:
Dim As Integer myarray(0 To ...) = {0, 1, 2, 3}
Print LBound(myarray), UBound(myarray)   '' 0, 3


Differences from QB:
See also:
Back to Procedures
Back to Variable Argument list
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode