Re: when can realloc fail?
- From: "santosh" <santosh.k83@xxxxxxxxx>
- Date: 1 Apr 2007 12:07:34 -0700
banansol@xxxxxxxxxxxx wrote:
Hi,
I just want to get this right.
A call to realloc() will return NULL on error
The word failure might be more appropriate in this context than the
word error.
and the original memory is left untouched,
both when requesting a larger or a smaller size that the original, right?
Yes.
But a call to realloc() with size set to zero is equivalent to free(),
Semantically yes.
with returns void.
No, it returns an indeterminate value.
Does that mean that a call to realloc() can fail when shinking memory except when
shrinking it to zero in which case it will always succeed?
No. realloc is not guaranteed to suceed even when the new size is zero.
.
- Follow-Ups:
- Re: when can realloc fail?
- From: banansol
- Re: when can realloc fail?
- References:
- when can realloc fail?
- From: banansol
- when can realloc fail?
- Prev by Date: Re: when can realloc fail?
- Next by Date: Re: when can realloc fail?
- Previous by thread: Re: when can realloc fail?
- Next by thread: Re: when can realloc fail?
- Index(es):
Relevant Pages
|
|