2 lint questions

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jul 29 05:35:06 AEST 1989


In article <5967 at ingr.com> boyd at ingr.com (Boyd Nation) writes:
-1)  How does one prevent lint from issuing a warning message about possible
-pointer alignment problems given the following line of code:
-	x = (blivet *)malloc(sizeof(blivet));

The only way is to substitute different code under "#ifdef lint" control.
If you actually plan on doing that, I recommend using a nice macro wrapper
defined to implement the actual malloc() call with casts etc. normally but
defined with a lint-free substitute under "#ifdef lint" conditions.

-2)  Is there any way to get lint to detect a closed loop of code which can
-never be called?  For example:
-	void func1()
-	{
-		func2();
-	}
-	void func2()
-	{
-	    func1();
-	}
-where there are no other calls to func1 or func2.

Nope.



More information about the Comp.lang.c mailing list