Content deleted Content added
m Stub-sorting. You can help! compu>compu-prog |
section titles, java example with autoboxing, removed stub |
||
Line 13:
In [[PHP]], [http://php.net/functions_arguments variable-length argument lists] are natively supported (without security risk) since version 4; dedicated functions (<TT>func_num_args</TT>, <TT>func_get_arg</TT>, <TT>func_get_args</TT>) allow the programmer to determine the number and values of unspecified arguments.
== Variadic functions in [[C++]] ==
The variadic function feature is going to be present in the upcoming [[C++]] language standard, [[C++0x]]; this feature is called "Variadic templates". This allows to create templates with variable number of template parameters, which can be also used to create a function with variable number of arguments:▼
▲The variadic function feature is going to be present in the upcoming
template<typename T>
Line 28 ⟶ 30:
}
== Variadic functions in [[C Sharp|C#]] and [[Java]] ==
Other languages, such as [[C#]] and [[Java]] use a different approach - they just allow that a variable number of arguments of the same type may be passed to a variadic function. Inside the method they are simply collected in an [[array]].▼
▲Other languages, such as
==See also==▼
public static void printSpaced(Object... objects) {
[[Variadic macro]] (C Programming Language)▼
for (Object o : objects)
System.out.print(o + " ");
}
// Can be used to print:
// printSpaced(1, 2, "three");
▲==See also==
▲* [[Variadic macro]] (C Programming Language)
* [[Java syntax]]
|