Created
January 10, 2020 03:18
-
-
Save frankie-yanfeng/b88715e740163149cc5c2f3e8971f753 to your computer and use it in GitHub Desktop.
One implementation of stdarg.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* stdarg.h standard header */ | |
#ifndef _STDARG | |
#define _STDARG | |
/* type definitions */ | |
typedef char *va_list; | |
/* macros */ | |
#define va_arg(ap, T) \ | |
(* (T *)(((ap) += _Bnd(T, 3U)) - _Bnd(T, 3U))) | |
#define va_end(ap) (void)0 | |
#define va_start(ap, A) \ | |
(void)((ap) = (char *)&(A) + _Bnd(A, 3U)) | |
#define _Bnd(X, bnd) (sizeof (X) + (bnd) & ~(bnd)) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment