How to let lint check your format strings

Andries Brouwer aeb at mcvax.UUCP
Fri Apr 12 06:14:24 AEST 1985


In article <518 at lll-crg.ARPA> brooks at lll-crg.ARPA (Eugene D. Brooks III) writes:
>> Something that may not have been obvious....to turn it back off
>> when the code is de-linted, have another .h file like this:
>> 
>> #define procent_a(a)	a
>> #define procent_b(a)	a
>
>The idea of having lint use constant format strings to check types and
>arg counts is a great one.  I have wanted to do this for many years as
>argument types and counts for printf and its buddies are one of my more
>frequent errors.  Could we come up with a system that does not require any
>includes or modifications to the code to do it?  This would be great!

The way I use printfck is to run my code through it, feed the result to lint
and then throw all this garbage away again. Code full of procent_x() calls
is good for lint but not for me when I want a nicely formatted listing.

People who not only like the idea but also want to actually use it may like
to know that guido at mcvax improved my version - ask him before you start
polishing printfck.c.



More information about the Comp.lang.c mailing list