版本3和4间的区别
于2007-08-07 19:54:52修订的的版本3
大小: 990
编辑: czk
备注:
于2008-02-23 15:35:12修订的的版本4
大小: 990
编辑: localhost
备注: converted to 1.6 markup
删除的内容标记成这样。 加入的内容标记成这样。
行号 2: 行号 2:
[[Navigation(slides)]] <<Navigation(slides)>>

<<Navigation: 执行失败 ['AllContext' object has no attribute 'values'] (see also the log)>>

B.7 Variable Argument Lists: <stdarg.h>

The header <stdarg.h> provides facilities for stepping through a list of function arguments of unknown number and type.

Suppose lastarg is the last named parameter of a function f with a variable number of arguments. Then declare within f a variable of type va_list that will point to each argument in turn:

  • va_list ap;

ap must be initialized once with the macro va_start before any unnamed argument is accessed:

  • va_start(va_list ap, lastarg);

Thereafter, each execution of the macro va_arg will produce a value that has the type and value of the next unnamed argument, and will also modify ap so the next use of va_arg returns the next argument:

  • type va_arg(va_list ap, type);

The macro

  • void va_end(va_list ap);

must be called once after the arguments have been processed but before f is exited.

TCPL/B.07_Variable_Argument_Lists:_<stdarg.h> (2008-02-23 15:35:12由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.