Malloc and lint

Rich Salz rsalz at bbn.com
Wed Nov 22 10:15:54 AEST 1989


I have found on most BSD machines if you provide your own wrapper
around malloc and declare it to return a "long *" rather than a
"char *" you only get one complaint.  This is good practice anyhow:

	typedef long *align_t;

	align_t
	myalloc(size)
	    unsigned int size;
	{
	    char *p;

	    if (p = malloc(size))
		return (align_t)p;
	    fatal("Ran out of memory");
	    /* NOTREACHED */
	}
-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.



More information about the Comp.lang.c mailing list