|
|
1.1 ! root 1: ! 2: #ifndef va_start ! 3: ! 4: /* ! 5: Proper usage of this version of varargs is slightly different from ! 6: that found in C. Functions are declared ! 7: ! 8: foo(int arg ...) { va_list ap; ... va_start(ap,arg1) ; ... ! 9: ! 10: rather than ! 11: ! 12: foo(va_alist) va_dcl { va_list ap; ... va_start(ap); ! 13: ! 14: use of va_arg, and va_end remain the same. ! 15: ! 16: Arg does not have to be int, but it must be declared. Hence ! 17: all calls of foo must have the same first type for their first ! 18: argument. (In the most common printf-like cases the first argument ! 19: is a char* format.) ! 20: */ ! 21: ! 22: typedef char *va_list; ! 23: #define va_start(list,last) list = (char *) &last ! 24: #define va_end(list) ! 25: #ifdef u370 ! 26: #define va_arg(list, mode) ((mode *)(list = \ ! 27: (char *) ((int)list + 2*sizeof(mode) - 1 & -sizeof(mode))))[-1] ! 28: #else ! 29: #define va_arg(list, mode) ((mode *)(list += sizeof(mode)))[-1] ! 30: #endif ! 31: ! 32: #endif ! 33: ! 34:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.