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

Ik Su Yoo ik at laic.UUCP
Mon Sep 10 09:03:46 AEST 1990


> 
> Well, I can just ignore warnings like this, but those who review
> my code (professors, employers, clients) are not likely to. It makes
> an bad impression and frankly, I find it a little embarrassing.
> (I'm embarrassed for those who publish code in which lint detects
> things like unused arguments, etc). I could just:
> #ifndef lint
>    m = (double *) malloc(...
> #endif
> but before long, the code looks disgusting.  Do you just ignore
> warnings like this and remain confident in your code, or do you
> do your best to work around them?
> 

Actually, I'm not at all embarrassed by getting lint errors like unused
arguments etc., although I'm not sure why you'd want to show lint output to
your customers. Sometimes, I find it necessary to specify unused arguments
to achieve proper abstraction, consistent argument specification, etc.

There is a rather simple solution (which I picked up from the net) to your
code getting messy from using `ifndef' with each `malloc':

#ifndef lint
#define MALLOC(size)			(malloc(size))
#else
#define MALLOC(size)			(0)
#endif

-- 
|  Ik Su Yoo                                 |  Office: (415) 354-5584        |
|  Scientist @ Lockheed AI Center            |  Fax:    (415) 354-5235        |
|  Orgn. 96-20, Bldg. 259, 3251 Hanover St.  |  E-mail: ik at laic.lockheed.com  |
|  Palo Alto, CA  94304-1191                 |                                |



More information about the Comp.lang.c mailing list