turbo-C and lint ?

a.lawrence alawrenc at sobeco.com
Sat Mar 24 22:33:04 AEST 1990


>From article <1964 at bruce.OZ>, by alanf at bruce.OZ (Alan Grant Finlay):
> I was surprised to discover that the Turbo-C package does not come with a lint
> program.  Specifically I want to have the ability to automatically check for
> procedure argument type consistency.  When in the past I have complained to
> C advocates that C compilers don't check for consistent use of parameters they
> have usually replied "that's what lint is for!".  Is it really acceptable for
> a commercial compiler package to come supplied without an essential part or
> have I missed something in the package that does the same job?

I think you had better take a second look at your compiler.  If you turn on
all the warning levels, it will do a much better job verifying your code than
most lint programs.  Turbo C has often found serious problems in programs 
which compiled and linted corrected on UNIX.

As far as function definitions go, if you use ANSI style function prototypes
Turbo C which check all of you function calls very closely, and even report
a warning when the code you right is acceptable C but probably not what you
wanted (suspicious pointer casts, etc).

If you want the code you are developing to be portable to non-ANSI compilers
use the following macro:

  	#ifdef ansi_style
	#define P(x)  x
	#else
	#define P(x)  ()
	#endif

and code your function prototype as:

	char *function P((int num, har *string));

---
On a clear disk you can seek forever.
-------------------------------------------------------------------------
Andrew Lawrence        |  alawrenc at sobmips.sobeco.UUCP
Informaticien Conseil  |  {attcan,mcgill-vision}!sobeco!sobmips!alawrenc
3462 Jeanne-Mance, #1  |
Montreal, Que  CANADA  |  Voice (514) 281-5196



More information about the Comp.lang.c mailing list