stdarg.h

来自「电力系统中的保护装置全部代码」· C头文件 代码 · 共 36 行

H
36
字号
/************************************************************************
	Standard variable argument header.

	va_start	initializes an arg pointer of type va_list.
	va_arg		gets the next argument given its promoted type.
			NOTE: the type cannot be "char" or "short" and
			instead must be the promoted type ("int") for
			such arguments.
	va_end		must be done at the end.

	A function defined to take a variable number of arguments
	should be patterned after:
		#include <stdarg.h>

		int f( int a, char *b, ... ) {  int x; long y;
		    va_list argp;
		    va_start( argp, b );
		       x = va_arg( argp, int );
		       y = va_arg( argp, long );
		    va_end( argp ); }
************************************************************************/
#ifndef __STDARG
#define __STDARG

#ifndef __VA_LIST
#define __VA_LIST
typedef char *va_list;
#endif

#define va_start(_ap, _parmN) (_ap = (char *)&_parmN)
#define va_end(_ap)
#define va_arg(_ap, _type)    ((_ap -= (sizeof(_type) > sizeof(int)) ? \
				        sizeof(_type) : sizeof(int)),  \
				        (*(_type *)(_ap)))
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?