[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Are there some potential problems if I use a self-defined memory acquirement function instead of realloc(3) in the l_alloc function?
- From: 孙世龙 sunshilong <sunshilong369@...>
- Date: Tue, 11 Aug 2020 11:49:42 +0800
>What matters is what the language
>standards say, and what they say is that realloc() is permitted to fail
>when shrinking a block. (Some realloc implementations never fail in that
>case, but many in common use do.)
Could you please please give me some references or documents for me to
go through?
What about malloc(3) provided by the stand C library?
Best Regards.
Sunshilong
On Tue, Aug 11, 2020 at 10:10 AM Andrew Gierth
<andrew@tao11.riddles.org.uk> wrote:
>
> >>>>> "Philippe" == Philippe Verdy <verdyp@gmail.com> writes:
>
> Philippe> I don't think thank shrinking or keeping the same size may
> Philippe> fail
>
> It doesn't matter what you think. What matters is what the language
> standards say, and what they say is that realloc() is permitted to fail
> when shrinking a block. (Some realloc implementations never fail in that
> case, but many in common use do.)
>
> --
> Andrew.