lint on malloc calls

T. William Wells bill at proxftl.UUCP
Sun Sep 18 16:10:51 AEST 1988


I don't see why this is being debated any longer.  I suggested
adding the following kludge to each file where malloc is used:

#ifdef lint
#define malloc(x) 0
#endif

to shut up lint; this will work because each use of malloc will
be changed from

	ptr = (type)malloc(size);

to

	ptr = (type)0;

If you don't like this because it doesn't type check the malloc
argument, you can do this instead:

#ifdef lint
void malloc_kludge(n) size_t n; { n = n; }
#define malloc(x) (malloc_kludge(x), 0)
#endif

Can we have an end to this?

---
Bill
novavax!proxftl!bill



More information about the Comp.lang.c mailing list