lint on malloc calls

greg yachuk greggy at infmx.UUCP
Sat Sep 10 04:36:51 AEST 1988


In article <39617 at linus.UUCP> jgb at linus.UUCP (Jonathan G. Bressel) writes:
>	nextentry = (entry *) malloc(sizeof(entry));
>
>Running lint -bach yields:
>
>	phone.c(61): warning: illegal pointer combination
>	phone.c(61): warning: possible pointer alignment problem

Most likely, you have a somewhat advanced lint that understands that
int's and pointers do not need to be the same size.  If you have no
previous definition for malloc, it defaults to returning an int.  Lint
might not be impressed when you try to cast this to a pointer.  If you
#include <alloc.h> (or whatever is appropriate for your compiler), this
complaint will likely go away.  Alternatively, you could code your own
definition:
	void *malloc(); or char *malloc();

>Thanks.
You're welcome (I hope this is correct!!??)

>-- 
>Jonathan G. Bressel					The MITRE Corporation
>							MS E095, POB 208,
>ARPA:   linus!jgb at mitre-bedford                   	Bedford, MA  01730
>UUCP:   ...{decvax,utzoo,philabs,genrad}!linus!jgb	(617) 271-2794


Greg Yachuk		Informix Software Inc., Menlo Park, CA	(415) 322-4100
{uunet,pyramid}!infmx!greggy		why yes, I DID choose that login myself

Yes, yes hammerheads; swimming, kissing; we are big and clever and we don't know
				anything!
God save hammerheads; keeping going; we are sleek and special, and we're sure of
				something



More information about the Comp.lang.c mailing list