stdarg.h

来自「AT80296C 单片机中使用此头文件可方便查找东西,方便于编程 板头文件」· C头文件 代码 · 共 51 行

H
51
字号
/*
**
** FILE:        stdarg.h
**
** SCCS:        @(#)stdarg.h	1.2
**
** CREATED:     Wed Jan  4 1995
**
** AUTHOR:      Kees de Bruin
**              <bruin@tasking.nl>
**
** COPYRIGHT:   (C) 1995, Tasking Software B.V.
**
** DESCRIPTION:
**
**      Macros and types for variable argument list to a function
**
** CHANGE LOG:
**
** 1.2  Changed the macros to match those defined by Watcom.
**      The sizeof() is replaced by a macro call which will round
**      the original sizeof() up to the nearest multiple of
**      sizeof(int).
**
** 1.1  Inital version from Intel
** */

#ifndef __STDARG_H
#define __STDARG_H

#ifndef __VA_LIST
#define __VA_LIST
typedef char                    *va_list[1];
#endif /* __VA_LIST */

    /*
    ** The following macro will determine the size of a type, variable or expression, rounded up to the nearest
    ** multiple of sizeof(int). This number is its size as function argument.
    **
    ** NOTE: sizeof(int) must be a power of 2!
    */

#define _INTSIZEOF(_type)       ( (sizeof(_type) + sizeof(int) - 1) & ~(sizeof(int) - 1) )

#define va_start( _ap, _arg )   ( (_ap)[0] = (char *)&_arg + _INTSIZEOF( _arg ), (void)0 )
#define va_arg( _ap, _type )    ( (_ap)[0] += _INTSIZEOF( _type ), \
                                  ( * (_type *)((_ap)[0] - _INTSIZEOF( _type )) ) )
#define va_end( _ap )           ( (_ap)[0] = 0, (void)0 )

#endif /* __STDARG_H */

⌨️ 快捷键说明

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