Path: utzoo!attcan!uunet!cs.utexas.edu!usc!elroy.jpl.nasa.gov!ames!ncar!dinl!noren From: noren@dinl.uucp (Charles Noren) Newsgroups: comp.lang.c Subject: Re: turbo-C and lint ? Keywords: PD lint Message-ID: <1556@dinl.mmc.UUCP> Date: 21 Mar 90 16:11:29 GMT References: <1964@bruce.OZ> <1990Mar20.130947.16583@cs.eur.nl> <1966@bruce.OZ> Reply-To: noren@dinl.UUCP (Charles Noren) Organization: Martin Marietta I&CS, Denver CO. Lines: 57 In article <1966@bruce.OZ> alanf@bruce.OZ (Alan Grant Finlay) writes: >In article <1990Mar20.130947.16583@cs.eur.nl>, reino@cs.eur.nl (Reino de Boer) writes: >In article <1555@dinl.mmc.UUCP>, noren@dinl.uucp (Charles Noren) writes: >Both of these were in reponse to my original query which may not have been >specific enough. Consider the following correct program: > >check(x,y) >long x; >char *y; >{ >printf("%10.10s ",y); >} >main() >{ >check(10l,"testing"); >} > >If you now remove the l after the 10 in the procedure call the compiler >issues no relevant warnings and the program misbehaves. Can Turbo-C >generate a warning for this kind of error? My Turbo C stuff is at home... but I suggest you use the ANSI C features of the compiler, so your code would become: void check(long x, char *y) /* I always want to explicitly say what the function returns, in this case nothing (the previous definition returned an int). */ { printf("%10.10s ", y); } main() { check(10l, "testing"); } ...now Turbo C, under its default settings, will check the argument list in the function check(). If the "l" is taken out, Turbo C will let you know. Turbo C should also tell you that you did not use argument x in function check(). These are the "lintish" features of the compiler. You can turn off the unused argument check by using a #pragma statement as documented in the Turbo C manuals (this corresponds to a same lint capability). As another poster has mentioned, the default checks on your code by Turbo C, while more than "standard" C compilers, is rather limited. Check the documentation for turning on more of the checks. -- Chuck Noren NET: ncar!dinl!noren US-MAIL: Martin Marietta I&CS, MS XL8058, P.O. Box 1260, Denver, CO 80201-1260 Phone: (303) 971-7930