This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: va_start still... [and again] with test case:
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: Ingo Krabbe <i dot krabbe at dokom dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 11 Feb 2004 00:15:42 -0800
- Subject: Re: va_start still... [and again] with test case:
- References: <20040211085333.761a12b2@ask.home.org>
Ingo Krabbe <i.krabbe@dokom.net> writes:
> So I decieded to write a test case and detected that error might be reproduced
> very easy:
...
> int
> test_func(s,format)
> const char* s;
> const char* format;
> {
> va_list arg;
> int done;
>
> va_start( arg, format );
...
> As far as I know the function int test_func with old-style
> definition syntax is well defined and might be used as variadic arg
> function ! Or am I wrong ???
I'm afraid you're wrong. Variadic functions *must* be written with
new-style syntax:
int
test_func (const char *s, const char *format, ...)
q.v. C99 6.7.5p1, 6.7.5.3 generally, 6.9.1p8, 7.5.1.4.
> Anyway there seems to be some old style code existent that uses this syntax
> (for example the i386 stdio-common/sscanf.c from glibc-3.2.3).
Such code is buggy. GCC might well not have used to diagnose this.
zw