Repository navigation
Cva Start
Home › Procedures › Cva_Start
Macro to initialize variadic argument list object variable
Cva_Start( argument_list, last_param )argument_listlast_param
In a variadic procedure definition, argument_list is a variable having the Cva_List type and must be initialized with Cva_Start to work with the variable length argument list passed to the procedure.
last_param is the last parameter before the Ellipsis ... in the variadic procedure definition.
Cva_Start can only be used in variadic procedures. A variadic procedure is declared or defined by specifying the Ellipsis ... as the last parameter, and will accept a variable number of arguments when calling the procedure.
Cva_Start is like a constructor for the variadic argument_list object and must eventually have a matching call to Cva_End, which is like a destructor. After Cva_End for argument_list has been called, argument_list can be reused and reinitialized with another call to Cva_Start. The Cva_Start and Cva_End calls must both be called in pairs in the same procedure (for cross platform compatibility).
Cva_Copy is similar to Cva_Start except it initializes a variadic argument_list object from an already initialized variadic argument_list object, like a copy constructor.
- Not available in the -lang qb dialect unless referenced with the alias
__cva_start.
- New to FreeBASIC
'' typical usage of iterating through all arguments
Sub proc cdecl(count As Integer, ... )
Dim args As Cva_List
Cva_Start( args, count )
For i As Integer = 1 To count
Print Cva_Arg( args, Integer )
Next
Cva_End( args )
End Sub
proc( 4, 4000, 300, 20, 1 )'' example of using cva_start to get the first argument
'' then restarting to get all the arguments
Sub proc cdecl(count As Integer, ... )
Dim args As Cva_List
'' get the first argument only
Cva_Start( args, count )
Print Cva_Arg( args, Integer )
Cva_End( args )
'' restart and get all the arguments
Cva_Start( args, count )
For i As Integer = 1 To count
Print Cva_Arg( args, Integer )
Next
Cva_End( args )
End Sub
proc( 4, 4000, 300, 20, 1 )Category: Procedures
Kind: keyword
Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing