<s>
In	O
mathematics	O
and	O
in	O
computer	B-General_Concept
programming	I-General_Concept
,	O
a	O
variadic	B-Language
function	I-Language
is	O
a	O
function	O
of	O
indefinite	O
arity	O
,	O
i.e.	O
,	O
one	O
which	O
accepts	O
a	O
variable	O
number	O
of	O
arguments	O
.	O
</s>
<s>
Support	O
for	O
variadic	B-Language
functions	I-Language
differs	O
widely	O
among	O
programming	O
languages	O
.	O
</s>
<s>
There	O
are	O
many	O
mathematical	O
and	O
logical	O
operations	O
that	O
come	O
across	O
naturally	O
as	O
variadic	B-Language
functions	I-Language
.	O
</s>
<s>
Another	O
operation	O
that	O
has	O
been	O
implemented	O
as	O
a	O
variadic	B-Language
function	I-Language
in	O
many	O
languages	O
is	O
output	O
formatting	O
.	O
</s>
<s>
The	O
C	B-Language
function	O
and	O
the	O
Common	B-Language
Lisp	I-Language
function	O
are	O
two	O
such	O
examples	O
.	O
</s>
<s>
Variadic	B-Language
functions	I-Language
can	O
expose	O
type-safety	B-Language
problems	O
in	O
some	O
languages	O
.	O
</s>
<s>
For	O
instance	O
,	O
C	B-Language
's	O
,	O
if	O
used	O
incautiously	O
,	O
can	O
give	O
rise	O
to	O
a	O
class	O
of	O
security	O
holes	O
known	O
as	O
format	B-Language
string	I-Language
attacks	O
.	O
</s>
<s>
The	O
attack	O
is	O
possible	O
because	O
the	O
language	O
support	O
for	O
variadic	B-Language
functions	I-Language
is	O
not	O
type-safe	B-Language
:	O
it	O
permits	O
the	O
function	O
to	O
attempt	O
to	O
pop	O
more	O
arguments	O
off	O
the	O
stack	O
than	O
were	O
placed	O
there	O
,	O
corrupting	O
the	O
stack	O
and	O
leading	O
to	O
unexpected	O
behavior	O
.	O
</s>
<s>
As	O
a	O
consequence	O
of	O
this	O
,	O
the	O
CERT	O
Coordination	O
Center	O
considers	O
variadic	B-Language
functions	I-Language
in	O
C	B-Language
to	O
be	O
a	O
high-severity	O
security	O
risk	O
.	O
</s>
<s>
In	O
the	O
functional	O
language	O
Haskell	B-Language
,	O
variadic	B-Language
functions	I-Language
can	O
be	O
implemented	O
by	O
returning	O
a	O
value	O
of	O
a	O
type	O
class	O
;	O
if	O
instances	O
of	O
are	O
a	O
final	O
return	O
value	O
and	O
a	O
function	O
,	O
this	O
allows	O
for	O
any	O
number	O
of	O
additional	O
arguments	O
.	O
</s>
<s>
To	O
portably	O
implement	O
variadic	B-Language
functions	I-Language
in	O
the	O
C	B-Language
programming	I-Language
language	I-Language
,	O
the	O
standard	O
header	O
file	O
is	O
used	O
.	O
</s>
<s>
The	O
older	O
header	O
has	O
been	O
deprecated	B-General_Concept
in	O
favor	O
of	O
.	O
</s>
<s>
In	O
C++	O
,	O
the	O
header	O
file	O
is	O
used	O
.	O
</s>
<s>
In	O
some	O
other	O
cases	O
,	O
for	O
example	O
printf	B-Language
,	O
the	O
number	O
and	O
types	O
of	O
arguments	O
are	O
figured	O
out	O
from	O
a	O
format	B-Language
string	I-Language
.	O
</s>
<s>
(	O
Alternatively	O
,	O
a	O
sentinel	B-Data_Structure
value	I-Data_Structure
like	O
may	O
be	O
used	O
to	O
indicate	O
the	O
number	O
.	O
)	O
</s>
<s>
If	O
fewer	O
arguments	O
are	O
passed	O
in	O
than	O
the	O
function	O
believes	O
,	O
or	O
the	O
types	O
of	O
arguments	O
are	O
incorrect	O
,	O
this	O
could	O
cause	O
it	O
to	O
read	O
into	O
invalid	O
areas	O
of	O
memory	O
and	O
can	O
lead	O
to	O
vulnerabilities	O
like	O
the	O
format	B-Language
string	I-Language
attack	O
.	O
</s>
<s>
In	O
C23	B-Language
,	O
the	O
second	O
argument	O
will	O
no	O
longer	O
be	O
required	O
and	O
variadic	B-Language
functions	I-Language
will	O
no	O
longer	O
need	O
a	O
named	O
parameter	O
before	O
the	O
ellipsis	O
.	O
</s>
<s>
C#	B-Application
describes	O
variadic	B-Language
functions	I-Language
using	O
the	O
keyword	O
.	O
</s>
<s>
The	O
basic	O
variadic	O
facility	O
in	O
C++	O
is	O
largely	O
identical	O
to	O
that	O
in	O
C	B-Language
.	O
The	O
only	O
difference	O
is	O
in	O
the	O
syntax	O
,	O
where	O
the	O
comma	O
before	O
the	O
ellipsis	O
can	O
be	O
omitted	O
.	O
</s>
<s>
C++	O
allows	O
variadic	B-Language
functions	I-Language
without	O
named	O
parameters	O
but	O
provides	O
no	O
way	O
to	O
access	O
those	O
arguments	O
since	O
va_start	O
requires	O
the	O
name	O
of	O
the	O
last	O
fixed	O
argument	O
of	O
the	O
function	O
.	O
</s>
<s>
Variadic	B-Language
templates	I-Language
(	O
parameter	O
pack	O
)	O
can	O
also	O
be	O
used	O
in	O
C++	O
with	O
language	O
built-in	O
fold	B-Application
expressions	I-Application
.	O
</s>
<s>
The	O
CERT	B-Language
Coding	I-Language
Standards	I-Language
for	O
C++	O
strongly	O
prefers	O
the	O
use	O
of	O
variadic	B-Language
templates	I-Language
(	O
parameter	O
pack	O
)	O
in	O
C++	O
over	O
the	O
C-style	O
variadic	B-Language
function	I-Language
due	O
to	O
a	O
lower	O
risk	O
of	O
misuse	O
.	O
</s>
<s>
Variadic	B-Language
functions	I-Language
in	O
Go	B-Application
can	O
be	O
called	O
with	O
any	O
number	O
of	O
trailing	O
arguments	O
.	O
</s>
<s>
is	O
a	O
common	O
variadic	B-Language
function	I-Language
;	O
it	O
uses	O
an	O
empty	O
interface	O
as	O
a	O
catch-all	O
type	O
.	O
</s>
<s>
As	O
with	O
C#	B-Application
,	O
the	O
type	O
in	O
Java	B-Language
is	O
available	O
as	O
a	O
catch-all	O
.	O
</s>
<s>
JavaScript	B-Language
does	O
not	O
care	O
about	O
types	O
of	O
variadic	O
arguments	O
.	O
</s>
<s>
It	O
's	O
also	O
possible	O
to	O
create	O
a	O
variadic	B-Language
function	I-Language
using	O
the	O
arguments	O
object	O
,	O
although	O
it	O
is	O
only	O
usable	O
with	O
functions	O
created	O
with	O
the	O
keyword	O
.	O
</s>
<s>
Lua	B-Language
functions	O
may	O
pass	O
varargs	B-Language
to	O
other	O
functions	O
the	O
same	O
way	O
as	O
other	O
values	O
using	O
the	O
keyword	O
.	O
</s>
<s>
tables	O
can	O
be	O
passed	O
into	O
variadic	B-Language
functions	I-Language
by	O
using	O
,	O
in	O
Lua	B-Language
version	O
5.2	O
or	O
higher	O
,	O
or	O
Lua	B-Language
5.1	I-Language
or	O
lower	O
.	O
</s>
<s>
Varargs	B-Language
can	O
be	O
used	O
as	O
a	O
table	O
by	O
constructing	O
a	O
table	O
with	O
the	O
vararg	B-Language
as	O
a	O
value	O
.	O
</s>
<s>
Pascal	B-Application
has	O
four	O
built-in	O
procedures	O
which	O
are	O
defined	O
as	O
variadic	O
,	O
which	O
,	O
because	O
of	O
this	O
special	O
condition	O
,	O
are	O
intrinsic	O
to	O
the	O
compiler	O
.	O
</s>
<s>
However	O
,	O
there	O
are	O
alternate	O
specifications	O
allowing	O
for	O
default	B-Language
arguments	I-Language
to	O
procedures	O
or	O
functions	O
which	O
make	O
them	O
work	O
variadically	O
,	O
as	O
well	O
as	O
polymorphism	B-Application
which	O
allows	O
a	O
procedure	O
or	O
function	O
to	O
have	O
different	O
parameters	O
.	O
</s>
<s>
Object	O
Pascal	B-Application
supports	O
polymorphic	B-Application
procedures	O
and	O
functions	O
,	O
where	O
different	O
procedure(s )	O
or	O
function(s )	O
can	O
have	O
the	O
same	O
name	O
but	O
are	O
distinguished	O
by	O
the	O
arguments	O
supplied	O
to	O
them	O
.	O
</s>
<s>
Pascal	B-Application
also	O
supports	O
default	B-Language
arguments	I-Language
,	O
where	O
the	O
value	O
of	O
an	O
argument	O
,	O
if	O
not	O
provided	O
,	O
is	O
given	O
a	O
default	O
value	O
.	O
</s>
<s>
For	O
the	O
first	O
example	O
,	O
polymorphism	B-Application
,	O
consider	O
the	O
following	O
:	O
</s>
<s>
For	O
default	B-Language
parameters	I-Language
,	O
consider	O
the	O
following	O
:	O
</s>
<s>
PHP	B-Application
does	O
not	O
care	O
about	O
types	O
of	O
variadic	O
arguments	O
unless	O
the	O
argument	O
is	O
typed	O
.	O
</s>
<s>
Python	B-Language
does	O
not	O
care	O
about	O
types	O
of	O
variadic	O
arguments	O
.	O
</s>
<s>
In	O
Raku	B-Application
,	O
the	O
type	O
of	O
parameters	O
that	O
create	O
variadic	B-Language
functions	I-Language
are	O
known	O
as	O
slurpy	O
array	O
parameters	O
and	O
they	O
're	O
classified	O
into	O
three	O
groups	O
:	O
</s>
<s>
Ruby	B-Language
does	O
not	O
care	O
about	O
types	O
of	O
variadic	O
arguments	O
.	O
</s>
<s>
Rust	B-Application
does	O
not	O
support	O
variadic	O
arguments	O
in	O
functions	O
.	O
</s>
<s>
Rust	B-Application
is	O
able	O
to	O
interact	O
with	O
C	B-Language
's	O
variadic	O
system	O
via	O
a	O
feature	O
switch	O
.	O
</s>
<s>
As	O
with	O
other	O
C	B-Language
interfaces	O
,	O
the	O
system	O
is	O
considered	O
to	O
Rust	B-Application
.	O
</s>
<s>
Swift	B-Application
cares	O
about	O
the	O
type	O
of	O
variadic	O
arguments	O
,	O
but	O
the	O
catch-all	O
type	O
is	O
available	O
.	O
</s>
<s>
A	O
Tcl	B-Operating_System
procedure	O
or	O
lambda	O
is	O
variadic	O
when	O
its	O
last	O
argument	O
is	O
:	O
this	O
will	O
contain	O
a	O
list	O
(	O
possibly	O
empty	O
)	O
of	O
all	O
the	O
remaining	O
arguments	O
.	O
</s>
