lint warning messages with malloc()

T. William Wells bill at twwells.uucp
Mon Nov 7 06:57:45 AEST 1988


In article <182 at umigw.MIAMI.EDU> steve at umigw.miami.edu (steve emmerson) writes:
: I sometimes use:
:
:     #ifdef lint
:     #   define  malloc(s)   0
:     #else
:         extern char *malloc();
:     #endif
:
: Unfortunately, this means that lint(1) can no longer check the type of the
: argument.  C'est la vie.

But you could do this:

#ifdef lint
static void malloc_kludge(n) size_t n; { n = n; }
#define malloc(x) (malloc_kludge(x), 0)
#else
extern char *malloc();
#endif

---
Bill
{uunet|novavax}!proxftl!twwells!bill



More information about the Comp.lang.c mailing list