Xref: utzoo comp.std.c:980 comp.lang.c:17336 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.std.c,comp.lang.c Subject: Re: realloc Message-ID: <9964@smoke.BRL.MIL> Date: 31 Mar 89 22:16:39 GMT References: <10170@bloom-beacon.MIT.EDU> <10032@ihlpb.ATT.COM> <9974@megaron.arizona.edu> <9122@alice.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article <9122@alice.UUCP> andrew@alice.UUCP (Andrew Hume) writes: >gregg townsend reminds us of the pANS ``feature'' that malloc(0) returns NULL. >can anyone provide the (or any) justification of this pointless stupid >definition? Sure. malloc() either fails or it succeeds. If it were required to succeed for a 0-sized allocation attempt, then additional semantics would have had to have been devised to deal with the 0-sized object pointed to by the returned non-null pointer. For example, should a series of malloc(0) calls return distinct pointers? Anyway, for the limited additional functionality this was considered too big a can of worms to open. Happens I'm the POC for 0-sized object extensions to C. There has so far been a distinct lack of interest in this area..