hiding lint's ravings (was Re: FAQ - malloc array - clarify)

Duane Morse duane at anasaz.UUCP
Sun Sep 9 07:35:28 AEST 1990


Here are two suggestions to remove lint's pointer alignment complaint.

1) Put #ifdef lint/#endif around the code and do something innocuous
when running lint.  If the profs read the code carefully, this may raise
their eyebrows.

2) Write your own "malloc" subroutine which returns 0 for success and
a nonzero value for failure; pass a pointer to where you want to store
the address and have the routine interpret it as a char **; use a
variable of the type you really need (struct whatever *) and cast it
to (char **) in the subroutine call -- lint won't complain about any
of this.

By the way, if the prof's really complain about this lint 'error' in your
program, it doesn't say much about their knowledge of lint.
-- 

Duane Morse	e-mail: duane at anasaz (or ... asuvax!anasaz!duane)
(602) 861-7609



More information about the Comp.unix.programmer mailing list