C++ Logo

std-proposals

Advanced search

Re: [std-proposals] realloc(3)

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 31 Oct 2025 10:29:18 -0700
On Friday, 31 October 2025 03:24:49 Pacific Daylight Time Alejandro Colomar via
Std-Proposals wrote:
> Hi Sebastian,
>
> On Fri, Oct 31, 2025 at 11:03:32AM +0100, Sebastian Wittmeier via Std-
Proposals wrote:
> > Using the existing alignment for realloc on microcontrollers:
> >
> >
> > - up to a maximum alignment?
> >
> >
> > - or avoiding over-aligning memory, when allocating
> >
> > problem is we would not only have to do it for aligned memory or memory
> > meant to be reallocated, but for all allocations
> Yeah, I guess it would be better an aligned_realloc(3) with a constraint
> that the alignment must be the same as the existing one.

Matches existing Microsoft practice, which says
"It's an error to reallocate memory and change the alignment of a block."

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/aligned-realloc?view=msvc-170

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2025-10-31 17:29:23