This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/9700: va_start gets __offset wrong in some situations


Synopsis: va_start gets __offset wrong in some situations

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Sat Feb 15 00:14:24 2003
State-Changed-Why:
    Not a bug. The man page says:
           The  first  use  of  the  va_arg  macro  after that of the
           va_start macro returns the argument after  last.   Succes­
           sive  invocations return the values of the remaining argu­
           ments.
    
    You also get the "two" from this small example:
    #include <stdarg.h>
                                                                                   
    void func(const char *first_custom,
              ...)
    {
      char *s;
      va_list custom_args;
      va_start (custom_args, first_custom);
      s = va_arg(custom_args, char *);
      printf ("%s\n", s);
      va_end (custom_args);
    }
                                                                                   
    int main() {
        func("one", "two", "three");
    }
    
    (also on Linux). Given the description on the man page,
    this is not surprising.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9700


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]