Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.unix.questions Subject: Re: Shutting lint up about malloc (missing /*NOSTRICT*/) Message-ID: <5871@brl-smoke.ARPA> Date: Mon, 18-May-87 18:28:32 EDT Article-I.D.: brl-smok.5871 Posted: Mon May 18 18:28:32 1987 Date-Received: Tue, 19-May-87 05:37:11 EDT References: <61@amanue.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 24 Keywords: lint malloc NOSTRICT I know of no way to keep the SVR2 "lint" from warning about possible type mismatch when converting pointers returned by malloc. However, you might consider implementing separate functions to allocate storage for each of your data types, which at least would isolate the warnings to one place in the code: ... foo *p, *foo_alloc(); ... p = foo_alloc(); ... foo * foo_alloc() { extern void fatal(); /* application utility routine */ extern char *malloc(); register char *p = malloc( sizeof(foo) ); /* the following check may not be suitable for your application */ /* (it's a strategic decision enforced in a low-level routine) */ if ( p == NULL ) fatal( "out of space" ); /* give up */ return (foo *)p; /* ignore "lint" warning here */ }