Content deleted Content added
→In C: Fix MOS:INSTRUCT Tags: Mobile edit Mobile web edit Advanced mobile edit |
Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
Line 52:
# {{code|va_arg}} takes two arguments, a {{code|va_list}} object (previously initialised) and a type descriptor. It expands to the next variable argument, and has the specified type. Successive invocations of {{code|va_arg}} allow processing each of the variable arguments in turn. Unspecified behavior occurs if the type is incorrect or there is no next variable argument.
# {{code|va_end}} takes one argument, a {{code|va_list}} object. It serves to clean up. If one wanted to, for instance, scan the variable arguments more than once, the programmer would re-initialise your {{code|va_list}} object by invoking {{code|va_end}} and then {{code|va_start}} again on it.
# {{code|va_copy}} takes two arguments, both of them {{code|va_list}} objects. It clones the second (which must have been initialised) into the first. Going back to the "scan the variable arguments more than once" example, this could be achieved by invoking {{code|va_start}} on a first {{code|va_list}}, then using {{code|va_copy}} to clone it into a second {{code|va_list}}. After scanning the variable arguments a first time with {{code|va_arg}} and the first {{code|va_list}} (disposing of it with {{code|va_end}}), the programmer could scan the variable arguments a second time with {{code|va_arg}} and the second {{code|va_list}}. {{code|va_end}} needs to also be called on the cloned {{code|va_list}} before the containing function returns.
===In C#===
|