Path: csiph.com!news.mixmin.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: "Catch-23: The New C Standard,Sets the World on Fire" by Terence Kelly with Special Guest Borer Yekai Pan
Date: Wed, 05 Apr 2023 21:20:38 -0700
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <868rf563qh.fsf@linuxsc.com>
References: <87zg7n89zw.fsf@bsb.me.uk> <86h6tu5kbk.fsf@linuxsc.com> <875yaa6sls.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="77e5ca47682db671e3b280870d0689dc"; logging-data="254700"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Jpha64zQ2BsTy5HTczH6YoLwU0hOQygs="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:DH4FU49qN797rKODvH1li8sCbQs= sha1:6abyjtm7mV2h9pCjqFl5mDpAgoo=
Xref: csiph.com comp.lang.c:169848
Ben Bacarisse writes:
> Tim Rentsch writes:
>
>> Ben Bacarisse writes:
>>
>> [context]
>>
>>>>>> "Catch-23: The New C Standard,Sets the World on Fire"
>>>>>> by Terence Kelly
>>>>>> https://queue.acm.org/detail.cfm?id=3588242
>>
>> [...]
>>
>>> But their example stack code lends itself to a puzzle: on what
>>> implementation assumptions does it depend? I believe it is not
>>> fully portable for reasons that are unrelated to the realloc
>>> implementation. [...]
>>
>> Can you elaborate on this comment? I don't see what you're
>> getting at.
>
> What happens when sizeof int == 1?
Clearly if push() is called when N == SIZE_MAX (which is possible
only if sizeof (int) == 1) then the code misbehaves. To me this
eventuality is more like an unlikely corner case than it is an
implementation assumption. Granted, the misbehavior can occur
only on some implementations, but the problem is that the code is
wrong, not that it has an implementation dependency. That said,
I see now how this situation fits with what you said earlier
mentioning "a puzzle" (although it still feels like the phrase
"implementation assumptions" is more misdirection than it is
something else).