Article View: comp.lang.c
Article #374Re: AVL tree insertion - programming exercise
From: Keith Thompson
Date: Wed, 14 Oct 2026 04:13
Date: Wed, 14 Oct 2026 04:13
50 lines
3398 bytes
3398 bytes
cross@spitfire.i.gajendra.net (Dan Cross) writes:
> In article <86v775h9o2.fsf@linuxsc.com>,
> Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>>cross@spitfire.i.gajendra.net (Dan Cross) writes:
[...]
>>> I don't think this is true anymore, as of C23. Here's the
>>> relevant text from n3220, sec 7.24.3, describing the return
>>> value from `malloc` et al:
>>>
>>> |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.
>>>
>>> This sentence is somewhat ambiguous because it's unclear whether
>>> the "less than or equal to the size requested" criteria applies
>>> to both the pointer type's size _and_ fundamental alignment
>>> requirement, or _just_ the size, [...]
>>
>>It's poorly constructed but in English it has only one
>>grammatical parse.
>
> Nope. Not even close.
I think Tim is right about there being only one grammatical parse.
I'll try to use indentation to indicate (imperfectly) how I parse it:
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.
So "a fundamental alignment requirement" and "size less than or equal
to the size requested" are parallel requirements, both applying to
the type of the pointed-to object.
I do see a problem with the size requirement being *under* the
"suitably aligned" requirement. It wrongly implies that satisfying
the size requirement contributes to the "suitably aligned" requirement.
But that's not an ambiguous parse.
Do you see a different way to parse the sentence?
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Technical Details
Message-ID:
<11amvh2$14pou$3@kst.eternal-september.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!kst.eternal-september.org!.POSTED!not-for-mailReferences:
<86ece2kppv.fsf@linuxsc.com> <11al4mu$fqtl$1@kst.eternal-september.org> <11ali2e$pi$1@reader2.panix.com> <86v775h9o2.fsf@linuxsc.com> <11am74c$54g$1@reader2.panix.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!kst.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson <Keith.S.Thompson+u@gmail.com> Newsgroups: comp.lang.c Subject: Re: AVL tree insertion - programming exercise Date: Tue, 13 Oct 2026 21:13:21 -0700 Organization: None to speak of Lines: 50 Message-ID: <11amvh2$14pou$3@kst.eternal-september.org> References: <86ece2kppv.fsf@linuxsc.com> <11al4mu$fqtl$1@kst.eternal-september.org> <11ali2e$pi$1@reader2.panix.com> <86v775h9o2.fsf@linuxsc.com> <11am74c$54g$1@reader2.panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 14 Oct 2026 04:13:22 +0000 (UTC) Injection-Info: kst.eternal-september.org; logging-data="1206046"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199hMYbg3rxH7lASqIvwvqy"; posting-host="8bc08a5e85dad83e60fe86919d5c20fb" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:vzV6xxxxnNDkLRohwN+l+/Pqdzk= sha256:gJzfvMwcAxOCafSeC0Z4+gUtHXHWTSy4bOq87kc8Asc= sha1:Cl+WbctM8Qe4SOxmXqfI8CMY804= sha256:bQvhUVtpBENxl9L5wO6RcQqpI2cPAXizN2/+bgL8ArQ=