Runtime-Support
Functions
-
Header
Files
6.1.6
Variable
Arguments
(stdarg.h)
Some functions can have a variable number
of
arguments whose types can
differ; such a function
is
called a variable-argument function. The
stdarg.
h
header declares three macros and a type that help you
to
use variable-
argument functions:
• The three macros
are
va-start
and
va-arg,
and
va-end.
These macros
are
used when the number and type
of
arguments may vary each time a
function is
called.
•
The type,
va-list,
is
a pointer type that can hold information for
va-start,
va-end,
and va-argo
A variable-argument function can use the objects declared
by
stdarg.
h
to
step through its argument list at run time, when
it
knows
the number and
types
of
arguments actually passed
to
it.
6.1.7
Standard
Definitions
(stddef.h)
The
stddef
. h header defines
two
types and
two
macros. The types include:
•
ptrdiff-t,
a signed integer type that
is
the data type resulting from the
subtraction
of
two
pointers;
and
•
size-t,
an
unsigned integer type that
is
the data type
of
the sizeof oper-
ator.
The macros include:
• The NULL macro,
which
expands
to
a null pointer constant(O),
and
• The offsetof(type, identifier) macro,
which
expands
to
an
integp.r that
has
type size-to The result
is
the value
of
an
offset in bytes
to
a structure
member (identifier) from the beginning
of
its structure (type).
These types and macros
are
used by several
of
the runtime-support functions.
6.1.8
General
Utilities
(stdlib.h)
6-6
The
stdlib.
h header declares several functions, one macro, and
two
types.
The types include:
•
div-t,
a structure type that
is
the type
of
the value returned
by
the
div
function,
and
•
Idiv-t,
a structure type that
is
the type
of
the value returned
by
the Idiv
function.
In
TMS34010
C,
ints and longs
are
the same size, so
div-t
and
Idiv-t
share
a common definition:
typedef
struct
(
int
quot,
rem;
}
div_t,
Idiv_t;
The
stdlib.
h header also declares many
of
the common library functions: