Xref: utzoo comp.std.c:1001 comp.lang.c:17391 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.std.c,comp.lang.c Subject: Re: realloc Message-ID: <3662@ficc.uu.net> Date: 3 Apr 89 15:43:12 GMT References: <10170@bloom-beacon.MIT.EDU> <10032@ihlpb.ATT.COM> <934@atanasoff.cs.iastate.edu> Organization: Xenix Support Lines: 29 [ malloc(0) -> NULL is a bug] In article <934@atanasoff.cs.iastate.edu>, hascall@atanasoff.cs.iastate.edu (John Hascall) writes: > And what would you have it return? An Address? Yes. > ...which points to zero bytes of allocated storage? Yes. > And would successive malloc(0) calls return the same pointer? No. > (you're not using any heap with each call) Yes you are. 4-8 bytes depending on memory model. > And then consider doing a "free" on such a pointer. Sure. malloc(NULL) -> NULL is an optimisation better performed by the programmer. -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Business: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. Personal: ...!texbell!sugar!peter, peter@sugar.hackercorp.com.