Hi Eugene,

On Wed, Dec 17, 2025 at 03:42:28PM +0100, Eugene Syromyatnikov wrote:
> On Wed, Dec 17, 2025 at 2:51 PM Alejandro Colomar <[email protected]> wrote:
> 
> 
> > +Otherwise,
> > +the behavior was undefined.
> 
> I think this statement is incorrect, or at least misleading, because
> the current reading (that includes DR460) of ISO 9899:2011 explicitly

Does DR460 retroactively fix C11, or is it incorporated as part of C17?

Can you please provide any links to the sources?

> states that the function must fail when the condition is not satisfied
> (and that is what OpenBSD has implemented), and that also makes any
> permissive specification non-conforming wrt C11 as it is now.

What do you mean by "permissive specification"?  I didn't understand
this sentence well.

> But that
> is also true that C11 _used to_ specify a failure to conform to this
> onerous restriction as UB, which rendered the programs malformed, but,
> on the other hand, kept libcs that implemented it permissively
> standard-conformant.
> 
> I understand that I am unnecessarily conscientious here,

Please, be very picky.  That'll result in a better manual page.  :)

> but I think
> it is important to articulate what the standard both says and used to
> say, as it is the reference point for the language implementations,

To some degree, I agree.  Except that the standard isn't that important
where it differs from reality.

> the totality of which an application developer can neither observe nor
> inspect, and relying on a couple of anecdotes in terms of
> implementations may lead to issues down the road. I guess the outcome
> of my rants is "don't use aligned_alloc and C11 together", or
> something along those lines.
> 
> > +.IP \[bu]
> > +If
> > +.I alignment
> > +was not a power of two,
> > +the behavior was undefined.
> 
> I can't find a version of the standard that mentions the power-of-two
> restriction, it pertains only posix_memalign.

Oops, you're right; this should be "if the alignment was an unsupported
value".


Have a lovely day!
Alex

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

Attachment: signature.asc
Description: PGP signature

Reply via email to