Hi Martin, Florian,

On Fri, Jun 27, 2025 at 02:54:34PM +0200, Martin Uecker wrote:
> Am Freitag, dem 27.06.2025 um 10:52 +0200 schrieb Florian Weimer:
> > * Alejandro Colomar:
> ...
> 
> > 
> > From an implementation perspective, we need clarification that the
> > allocation functions (except aligned_alloc) may reduce the alignment of
> > the returned pointer to a power of two greater or equal to the requested
> > size, for allocation sizes that are less than the fundamental alignment.
> > (Some existing implementations already do this today, in violation of
> > the standard.)
> 
> There is a general rule for all allocation functions:
> 
> "The pointer returned if the allocation succeeds is suitably aligned so
> that it may be assigned to a pointer to any type of object with a fundamental
> alignment requirement and size less than or equal to the size requested."
> 
> There is some disagreement whether the "requested size" refers to theĀ 
> size argument or the total size.  IMHO it is a reasonable interpretationĀ 
> that it refers to the size argument, but if implementation would explict
> this this could then break programs that swap arguments (the standard
> has no symmetry, it makes clear which is which)

Okay, I'll tweak the wording to make it clear it's the total size.
That's an easy fix.


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to