Subject: lint vs stdarg.h
To: None <tech-userlevel@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-userlevel
Date: 11/18/2003 01:42:16
This doesn't look right to me:

% cat z.c
#include <stdarg.h>

struct foo { int i; };

extern void bar(struct foo);

extern void foo(struct foo, ...);
void foo(struct foo f, ...)
{
 va_list ap;

 va_start(ap,f);
 bar(f);
 while (f.i)
  { f = va_arg(ap,struct foo);
    bar(f);
  }
}
% lint z.c
z.c:
z.c(12): first operand must have scalar type, op ? :
z.c(15): warning: ap may be used before set
% 

Looking at the code, it looks as though the former will still arise on
many architectures (sparc and i386 at a minimum) and the latter will
remain on a few (MIPS and PowerPC - ironically, the very ones on which
it appears the former is gone).  I'd test it but for the lack of a
suitable installation to do it on.

Just in case anyone cares....

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B