Error: "va_start used in function with fixed args"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saurabhchokshi
    New Member
    • Feb 2008
    • 4

    #1

    Error: "va_start used in function with fixed args"

    I am using the vfprintf in my application. I am using count for va_list.

    char *p;
    va_list temp;
    va_start(temp, p + sizeof(void *));
    vfprintf(fd, format, temp);
    va_end(temp);

    In this code, I am getting compilation for "va_start used in function with fixed args"

    Could you please give me input to get rid of this error??
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    va_start is intended to be used on the parameters of a varidac function.

    Calling it on local variables is likely to have indeterminate results or undefined behaviour as that is not how va_start was designed to be used. Your stack based variables may be held in a different manor to your function parameters on any given platform.

    Comment

    • saurabhchokshi
      New Member
      • Feb 2008
      • 4

      #3
      Correct. I haven't use that option previously. But I have noticed that sizeof(va_list) on 64-bit is 24 bytes.

      I am using the char * as a argument list i.e. 8 bytes. Is this cause an error in compilation?

      Comment

      Working...