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

Christopher R Volpe volpe at underdog.crd.ge.com
Mon Sep 10 23:00:59 AEST 1990


In article <8086 at helios.TAMU.EDU>, jdm5548 at diamond.tamu.edu (James
Darrell McCauley) writes:
|>How do you professionals deal with insignificant(?) ravings from
|>lint (or other high quality C program verifiers) such as the 
|>following:
|>
|>>test.c(x): warning: possible pointer alignment problem

I don't know if this will work, since my lint doesn't complain
about this possible alignment problem, but how about trying
the following?

#include <malloc.h>
#ifdef LINT
double *(*_malloc)() = (double *(*)()) malloc; /* note underscore */
#define malloc (*_malloc)
#endif

This declares "_malloc" to be a pointer to a function returning pointer
to double, and initializes it with the address of the malloc routine,
suitably cast. Then, all calls to "malloc" actually use "(*_malloc)",
which returns objects with proper alignment as far as lint is concerned.
                                         
==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.unix.programmer mailing list