🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5801

Re: realloc

#5801
From: Doug Gwyn
Date: Fri, 31 Mar 1989 22:16
15 lines
1273 bytes
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..
Technical Details
Message-ID: <9964@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!haven!adm!smoke!gwyn
References: <10170@bloom-beacon.MIT.EDU> <10032@ihlpb.ATT.COM> <9974@megaron.arizona.edu> <9122@alice.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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) <gwyn>)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 15