🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3092

Re: What does malloc(0) return?

#3092
From: Doug Gwyn
Date: Fri, 31 May 1991 19:17
6 lines
781 bytes
In article <11614@ncar.ucar.edu> steve@unidata.ucar.edu (Steve Emmerson) writes:
>The subject-line says it all and my K&R2 is silent on the matter.

malloc(0) should return either NULL or a pointer to some storage location.
Technically the behavior is undefined, since there are no objects of the
specified size (0) according to the standard.
Technical Details
Message-ID: <16317@smoke.brl.mil>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!caen!zaphod.mps.ohio-state.edu!wuarchive!rex!ukma!hsdndev!cmcl2!adm!smoke!gwyn
References: <11614@ncar.ucar.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!caen!zaphod.mps.ohio-state.edu!wuarchive!rex!ukma!hsdndev!cmcl2!adm!smoke!gwyn
From: gwyn@smoke.brl.mil (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: What does malloc(0) return?
Message-ID: <16317@smoke.brl.mil>
Date: 31 May 91 19:17:48 GMT
References: <11614@ncar.ucar.edu>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 6