Article View: comp.std.c
Article #2200Re: realloc() unable to allocate
From: Norman Diamond
Date: Sat, 03 Oct 1992 04:34
Date: Sat, 03 Oct 1992 04:34
17 lines
1495 bytes
1495 bytes
In article <BvIJJz.BpD@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard) writes: >If realloc() is unable to allocate the larger space desired, what happens? >7.10.3.4 says: "... If the space cannot be allocated, the object pointed > to by ptr is unchanged. ..." >and "The realloc function returns either a null pointer or a pointer to the > possible moved allocated space". >While it SEEMS apparent that the meaning is that if realloc() cannot allocate >more space, it would return the NULL pointer The first paragraph in ANSI 4.10.3 (Memory management functions) says: "If the space cannot be allocated, a null pointer is returned." If the program wants to remember where the existing allocation is, it has to keep that in another pointer. -- Norman Diamond diamond@jit081.enet.dec.com If this were the company's opinion, I wouldn't be allowed to post it. "Yeah -- bad wiring. That was probably it. Very bad."
Technical Details
Message-ID:
<1992Oct3.043435.1643@nntpd.lkg.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!decwrl!deccrl!news.crl.dec.com!news!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamondReferences:
<BvIJJz.BpD@ux1.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!decwrl!deccrl!news.crl.dec.com!news!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond From: diamond@jit345.bad.jit.dec.com (Norman Diamond) Subject: Re: realloc() unable to allocate Message-ID: <1992Oct3.043435.1643@nntpd.lkg.dec.com> Sender: usenet@nntpd.lkg.dec.com (USENET News System) Reply-To: diamond@jit.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo References: <BvIJJz.BpD@ux1.cso.uiuc.edu> Date: Sat, 3 Oct 1992 04:34:35 GMT Lines: 17