lint on malloc calls
Jonathan G. Bressel
jgb at linus.UUCP
Fri Sep 9 06:12:38 AEST 1988
What is the best way of using malloc to get a pointer to a structure?
I am using the line below:
nextentry = (entry *) malloc(sizeof(entry));
where nextentry is defined as
entry *nextentry;
Running lint -bach yields:
phone.c(61): warning: illegal pointer combination
phone.c(61): warning: possible pointer alignment problem
What am I doing wrong? Doesn't K+R suggest this on pp. 133-134 (at
the end of section 6.5)?
Thanks.
--
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
More information about the Comp.lang.c
mailing list