This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c/5206: va_start() macro can't be used due to ISO C/non-ISO C conflict.
- From: rth at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, tom dot williams at diversifiedsoftware dot com
- Date: 28 Dec 2001 01:01:54 -0000
- Subject: Re: c/5206: va_start() macro can't be used due to ISO C/non-ISO C conflict.
- Reply-to: rth at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, tom dot williams at diversifiedsoftware dot com, gcc-gnats at gcc dot gnu dot org
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