SW500009 Microchip Technology, SW500009 Datasheet - Page 284

HI-TECH FOR DSPIC/PIC24

SW500009

Manufacturer Part Number
SW500009
Description
HI-TECH FOR DSPIC/PIC24
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC24 & DsPICr
Datasheet

Specifications of SW500009

Supported Families
PIC24
Core Architecture
PIC, DsPIC
Software Edition
Standard
Kit Contents
Software And Docs
Tool Type
Compiler
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
DSPIC3X/PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
025
778-1003
778-1003
VA_START, VA_ARG, VA_END
Synopsis
Description
These macros are provided to give access in a portable way to parameters to a function represented in
a prototype by the ellipsis symbol (...), where type and number of arguments supplied to the function
are not known at compile time.
macros, as it is the starting point for access to further parameters. In a function taking variable num-
bers of arguments, a variable of type va_list should be declared, then the macro va_start() invoked
with that variable and the name of parmN. This will initialize the variable to allow subsequent calls
of the macro va_arg() to access successive parameters.
which is the type that the next parameter is expected to be. Note that any arguments thus accessed
will have been widened by the default conventions to int, unsigned int or double. For example if a
character argument has been passed, it should be accessed by va_arg(ap, int) since the char will
have been widened to int.
of other parameters. In this example the function expects the subsequent parameters to be pointers
to char, but note that the compiler is not aware of this, and it is the programmers responsibility to
ensure that correct arguments are supplied.
Example
270
The rightmost parameter to the function (shown as parmN) plays an important role in these
Each call to va_arg() requires two arguments; the variable previously defined and a type name
An example is given below of a function taking one integer parameter, followed by a number
#include <stdarg.h>
void va_start (va_list ap, parmN )
type va_arg (ap, type)
void va_end (va_list ap)
#include <stdio.h>
#include <stdarg.h>
void
pf (int a, ...)
{
Library Functions

Related parts for SW500009