Content deleted Content added
m Popups-assisted disambiguation from Function to function (programming) |
No edit summary |
||
Line 7:
Variadic functions can expose type-safety problems in some languages. For instance, C's <TT>printf</TT>, if used uncautiously, can give rise to a class of security holes known as [[format string attack]]s. The attack is possible because the language support for variadic functions is not [[type safety|type-safe]]; it permits the function to attempt to pop more arguments off the stack than were placed there -- corrupting the stack and leading to unexpected behavior.
To portably implement variadic functions in the C programming language, the standard [http://www.opengroup.org/onlinepubs/009695399/basedefs/stdarg.h.html <tt><stdarg.h></tt>] header file should be used. The older <tt><varargs.h></tt> header has been deprecated in favor of [http://www.opengroup.org/onlinepubs/007908799/xsh/varargs.h.html <tt><stdarg.h></tt>].
In [[PHP]], [http://php.net/functions_arguments variable-length argument lists] are natively supported (without security risk) since version 4; dedicated functions (func_num_args, func_get_arg, func_get_args) allow the programmer to determine the number and values of unspecified arguments.▼
▲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.
==See also==
|