Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!shadooby!oxtrap!teemc!ka3ovk!tcsc3b2!pag From: pag@tcsc3b2.tcsc.com (Philip A. Gross) Newsgroups: comp.lang.c Subject: Re: lint vs varargs Keywords: casts lint varargs Message-ID: <1989Oct26.171829.7520@tcsc3b2.tcsc.com> Date: 26 Oct 89 17:18:29 GMT References: <453@bdrc.UUCP> Organization: The Computer Solution Company, Inc. Lines: 61 jcl@bdrc.UUCP (John C. Lusth) writes: >I have a lint question. Why does lint complain about varargs stuff? [...stuff deleted...] >Plain old lint yields: > test.c(19): warning: possible pointer alignment problem >Linting this beastie with the -c option yields: > test.c(18): warning: illegal pointer combination > test.c(19): warning: illegal pointer combination > test.c(19): warning: possible pointer alignment problem >-- >John C. Lusth, Becton Dickinson Research Center, RTP, NC, bdrc!jcl@mcnc John- You may want to try placing the following comment before your function which uses varargs. /* VARARGS */ Most versions of lint will recognize this comment and then properly ignore the undeclared parameters. For example, /* VARARGS */ char * make_string (astring, p1, p2, p3, p4, p5, p6, p7 p8 p9) char *astring; { static char s[80]; sprintf (s, astring, p1, p2, p3, p4, p5, p6, p7, p8, p9); return (s); } And thus a call to make_string as shown below: print_stuff ("foo %s\n", "bar"); would produce: foo bar I hope this is of some assistance. This function 'should' pass lint without any errors. =============================================================================== Philip A. Gross The Computer Solution Co., Inc. Voice: 804-794-3491 ------------------------------------------------------------------------------- INTERNET: pag@tcsc3b2.tcsc.com USENET: ...!tcsc3b2!pag UUCP: tcsc3b2!pag (804)794-1514 ATTMAIL: attmail!tcsc3b2!pag ------------------------------------------------------------------------------- The opinions expressed here are strictly mine and nobody elses. << I haven't heard what I have to say about that yet. >> :-)