Article View: comp.lang.c
Article #1283Re: C: a question about scope automatics in C
From: Keith Thompson
Date: Tue, 03 Nov 2026 01:28
Date: Tue, 03 Nov 2026 01:28
62 lines
3913 bytes
3913 bytes
Ross Finlayson <ross.a.finlayson@gmail.com> writes:
> On 11/02/2026 03:09 PM, Keith Thompson wrote:
>> Ross Finlayson <ross.a.finlayson@gmail.com> writes:
>>> C: a question about scope automatics in C
>>
>> No need to mention C in the subject (twice). We know what newsgroup
>> we're in.
>>
>>> Hello, I hope someone can tell me whether C may make
>>> for scope automatics any account of attaching side-effects
>>> to block-declared variables about scope-exit of automatics
>>> making for any way in C to attach behavior to scope-exit,
>>> or any way to make for when a variable goes out of scope
>>> (block-scope, or, function-scope) to make any account of
>>> cleanup of it.
>>
>> FWIW, you could have probably said that more clearly with about a
>> third as many words.
>>
>> You mentioned alloca() in a followup. Memory allocated by alloca() is
>> deallocated on exit from the function, not on leaving a smaller scope.
>> And of course alloca() is non-standard (not even specified by POSIX).
>>
>> There's a proposal for C2y, adding a new _Defer keyword.
>>
>> https://www.open-std.org/jtc1/sc22/wg14/www/docs/n4001.pdf
>>
>
> Thanks. I figure that "storage-class" is thoroughly defined in C,
> then with regards to stack-segment and data-segment, that being
> more-than-less common.
>
> Looking at something like "WG14/N1256 Committee Draft — Septermber 7,
> 2007 ISO/IEC 9899:TC3", I'm not sure what "Septermber" is, yet
> generously read it's a month of the year, Annex C is for "Sequence
> points", that 7.20.3 has "Memory management functions" that I can see
> there, about 6.2.2 "Linkages of identifiers", 6.2.4 "Storage durations
> of objects", from 6.2.4 "An object whose identifier is declared with no
> linkage and without the storage-class specifier static has automatic
> storage duration."
N1256 is an old committee draft, consisting of the C99 standard with
the three Technical Corrigenda merged into it. It's now mostly of
historical interest.
N1570 is a public draft that's very close to the C23 standard.
N3220 is a public draft that's very close to the current C23 standard.
[68 lines deleted]
> So, it's a number of questions about "implementation-defined behavior in C".
And that number appears to be zero.
You've quoted passages from and old draft of the standard, but
you haven't actually asked any question. Feel free to do so --
briefly, if you can manage it.
--
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:
<11cbdbb$3ce82$1@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:
<oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com> <11cb56q$39nj8$2@kst.eternal-september.org> <MVCdnSzYwpQKq3T3nZ2dnZfqn_udnZ2d@giganews.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: C: a question about scope automatics in C Date: Mon, 02 Nov 2026 17:28:11 -0800 Organization: None to speak of Lines: 62 Message-ID: <11cbdbb$3ce82$1@kst.eternal-september.org> References: <oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com> <11cb56q$39nj8$2@kst.eternal-september.org> <MVCdnSzYwpQKq3T3nZ2dnZfqn_udnZ2d@giganews.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 03 Nov 2026 01:28:12 +0000 (UTC) Injection-Info: kst.eternal-september.org; logging-data="3553538"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18z4Z1efP53OibwU+N54Q8z"; posting-host="4b0556bf440e84bc0e183151c34edde6" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:Jzvu3sNr8G/AyrjHLjJYhcnlIcg= sha256:AKztbBOsiT+mn3wyLRy0hl8Wcocerb2Y9A4c/fHDI7A= sha1:vpukhp8xXyEZIdGSPJlEee/vir0= sha256:1fxKcCbXkEUhPKeGyK+W3fxgURTNsXn5eDiGPm7S8As=