This is the mail archive of the gcc@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: va_start still... [and again] with test case:


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


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