c/5206: va_start() macro can't be used due to ISO C/non-ISO C conflict.

rth@gcc.gnu.org rth@gcc.gnu.org
Fri Dec 28 02:46:00 GMT 2001


Synopsis: va_start() macro can't be used due to ISO C/non-ISO C conflict.

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Thu Dec 27 17:01:54 2001
State-Changed-Why:
    Not a bug.
    
    You are confused about how traditional varargs works.  The function declaration shall be of the form
    
    int foo(va_alist)
        va_dcl
    {
      va_list ArgPtr;
      va_start (ArgPtr);
      va_end (ArgPtr);
    }
    
    Anything else will fail.  See the K&R C book.
    
    As for the stdarg.h test case, of course it fails.  What did you expect?  The stdarg.h va_start requires two arguments.  It also may only be used inside a function
    declared with a variable parameter list (i.e. "..."), so just randomly invoking it inside main is also going to fail.

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



More information about the Gcc-bugs mailing list