Path: utzoo!utgpu!watserv1!watmath!att!occrsh!uokmax!munnari.oz.au!samsung!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: FAQ - malloc array - clarify Keywords: malloc, Sun, lint Message-ID: <26438@mimsy.umd.edu> Date: 8 Sep 90 21:22:58 GMT References: <8056@helios.TAMU.EDU> <1990Sep08.022034.8444@virtech.uucp> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 16 In article <1990Sep08.022034.8444@virtech.uucp> cpcahil@virtech.uucp (Conor P. Cahill) writes: [re the lint error from `ptr = malloc(expr * sizeof(sometype))': malloc, arg. 1 used inconsistently] >This is caused by the argument to malloc being unsigned, not signed. A >cast in your code will fix this. Note that the cast is only required in old, broken compilers where the result of `sizeof' is an int instead of a size_t (typically unsigned int). These compilers are remarkably widespread (and, unfortunately, fixing them breaks some existing code, which is why I have not fixed ours here yet). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris