varargs.h vs. lint
Chris Torek
chris at trantor.umd.edu
Sun Feb 28 19:04:52 AEST 1988
In article <1078 at pasteur.Berkeley.Edu> dheller at cory.Berkeley.EDU.UUCP
(Dan Heller) writes:
>I have reservations about wanting to use varargs for _all_ the arguments
>passed to the function. While lint be be told not to "complain", it avoids
>lint's ability to find potential mistakes in the calling routines.
True enough. I have found, however, that /*VARARGSn*/ does not quite
work as advertised; and the following trick enables type checking
while still using varargs according to definition:
#ifdef lint
/* VARARGS ARGSUSED */
message(fmt) char *fmt; { }
#define message _lint_message
#endif lint
/* VARARGS */
message(va_alist)
va_dcl
{
va_list l;
va_start(l);
...
va_end(l);
}
#undef message
This creates warnings about _lint_message being unused, but a short
`grep' fixes that right up:
lint ... | grep -v '_lint_.* defined.*but never used'
The dpANS would suggest a name other than _lint_message; X_lint_message
should be fine.
--
In-Real-Life: Chris Torek, Univ of MD Computer Science, +1 301 454 7163
(still on trantor.umd.edu because mimsy is not yet re-news-networked)
Domain: chris at mimsy.umd.edu Path: ...!uunet!mimsy!chris
More information about the Comp.lang.c
mailing list