c++ - ‘va_start’ used in function with fixed args va_start(ap, flags); -
this seemingly simple code snipets giving me error cant figure out:
the error message is: ‘va_start’ used in function fixed args va_start(ap, flags);
static inline int sgx_wrapper_open64(const char *pathname, int flags,unsigned int mode) { va_list ap; va_start(ap, flags); if (flags & o_creat) mode = va_arg(ap, mode_t); else mode = 0777; va_end(ap); int retval; ocall_open2(&retval, pathname, flags, mode); return retval; }
that's because va_start
(and other variadic helper "functions") can used in functions argument list ends in elipsis ...
.
if can, modify function like
static inline int sgx_wrapper_open64(const char *pathname, int flags, ...) { va_list ap; va_start(ap, flags); mode_t mode; if (flags & o_creat) mode = va_arg(ap, mode_t); else mode = 0777; va_end(ap); int retval; ocall_open2(&retval, pathname, flags, mode); return retval; }
note change of function argument list, , addition of local variable mode
.
Comments
Post a Comment