Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!zaphod.mps.ohio-state.edu!rpi!crdgw1!underdog!volpe From: volpe@underdog.crd.ge.com (Christopher R Volpe) Newsgroups: comp.unix.programmer Subject: Re: hiding lint's ravings (was Re: FAQ - malloc array - clarify) Keywords: malloc, Sun, lint Message-ID: <11730@crdgw1.crd.ge.com> Date: 10 Sep 90 13:00:59 GMT References: <8056@helios.TAMU.EDU> <1990Sep08.022034.8444@virtech.uucp> <8086@helios.TAMU.EDU> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@underdog.crd.ge.com (Christopher R Volpe) Lines: 27 In article <8086@helios.TAMU.EDU>, jdm5548@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 #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@crd.ge.com