🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1572

Re: malloc(0)

#1572
From: Doug Gwyn
Date: Tue, 07 Aug 1990 12:23
12 lines
1048 bytes
In article <1990Aug6.142050.18629@gli.com> bobj@gli.com (Robert Jacobs) writes:
>About using malloc(0) to point to a unique place. What's wrong with using
>malloc(1) ??
>That way malloc(0) would do what is expected. Return a NULL pointer.
>This just seems too easy, doesn't it?

Yes, it seems too easy because it is too easy.

The issue was that it is not clear what to "expect" malloc(0) to return.
The standard was deliberately vague on this point, because X3J11 was
fairly evenly divided on the issue, but in much better agreement that it
wasn't such an important point that it had to be nailed down in the spec.
Technical Details
Message-ID: <13502@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn
References: <13384@smoke.BRL.MIL> <1990Jul26.232216.15093@oresoft.com> <1990Aug6.142050.18629@gli.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: malloc(0)
Message-ID: <13502@smoke.BRL.MIL>
Date: 7 Aug 90 12:23:09 GMT
References: <13384@smoke.BRL.MIL> <1990Jul26.232216.15093@oresoft.com> <1990Aug6.142050.18629@gli.com>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 12