realloc

Norman Diamond diamond at jit345.swstokyo.dec.com
Tue Apr 23 10:14:51 AEST 1991


In article <91112.102011LSC at SLACVM.SLAC.STANFORD.EDU> LSC at 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 at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.



More information about the Comp.std.c mailing list