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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -