🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2786

Re: realloc

#2786
From: Norman Diamond
Date: Tue, 23 Apr 1991 00:14
24 lines
1745 bytes
In article <91112.102011LSC@SLACVM.SLAC.STANFORD.EDU> LSC@SLACVM.SLAC.STANFORD.EDU writes:

>     In the ANSI standard, p 155 line 23, it says:
I have the Dec. 1988 draft and it's page 156 there.

>     "If the space cannot be allocated, the object pointed to by ptr is unchang
>unchanged."
>     Does this mean that one has no means of checking the success or failure
>of the operation? Does one have to resort to errno?

No.  It only means that ptr still points to the object and the object is
not changed.  The value of the actual parameter did not get changed anyway
because C has call-by-value semantics.  The quoted line only says that the
value still points to the same object.

Failure is still indicated by returning a null pointer as the function's
returned value.  This is on page 155 in the Dec. 1988 draft, lines 17-18.
This paragraph applies to all memory allocation routines.

I cannot find any guarantee that errno gets set when errors occur in
memory allocation routines.
--
Norman Diamond       diamond@tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Technical Details
Message-ID: <1991Apr23.001451.14900@tkou02.enet.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!jit345!diamond
References: <91112.102011LSC@SLACVM.SLAC.STANFORD.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!jit345!diamond
From: diamond@jit345.swstokyo.dec.com (Norman Diamond)
Newsgroups: comp.std.c
Subject: Re: realloc
Message-ID: <1991Apr23.001451.14900@tkou02.enet.dec.com>
Date: 23 Apr 91 00:14:51 GMT
References: <91112.102011LSC@SLACVM.SLAC.STANFORD.EDU>
Sender: usenet@tkou02.enet.dec.com (USENET News System)
Reply-To: diamond@jit345.enet@tkou02.enet.dec.com (Norman Diamond)
Organization: Digital Equipment Corporation Japan , Tokyo
Lines: 24