Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!okstate!gregg From: gregg@a.cs.okstate.edu (Gregg Wonderly) Newsgroups: comp.unix.questions Subject: Re: Shutting lint up about malloc (missing /*NOSTRICT*/) Message-ID: <1994@a.cs.okstate.edu> Date: Mon, 18-May-87 12:27:18 EDT Article-I.D.: a.1994 Posted: Mon May 18 12:27:18 1987 Date-Received: Tue, 19-May-87 03:46:50 EDT References: <61@amanue.UUCP> Organization: Oklahoma State Univ., Stillwater Lines: 32 in article <61@amanue.UUCP>, jr@amanue.UUCP (Jim Rosenberg) says: > > This is driving me nuts. I can't get lint on my system to shut up about > malloc. In response to the following code: > ...... > > /*NOSTRICT*/ > if ((p = (struct foo*) malloc(sizeof(struct foo))) == NULL) { > (void) fprintf(stderr, "Out er memory, turkey\n"); > return NULL; > } Try making this %%%%%%%%%%%%%% if ((p = (struct foo*) malloc(sizeof(struct foo))) == (struct foo *)NULL) { (void) fprintf(stderr, "Out er memory, turkey\n"); return NULL; } Comparing a structure pointer (namely p) against NULL (sometimes declared as ((char *)0) is probably biting you. ----- Gregg Wonderly Department of Computing and Information Sciences Oklahoma State University UUCP: {cbosgd, ea, ihnp4, isucs1, mcvax, uokvax}!okstate!gregg ARPA: gregg@A.CS.OKSTATE.EDU