Article View: comp.lang.c
Article #1265Re: C: a question about scope automatics in C
From: Ross Finlayson
Date: Mon, 02 Nov 2026 18:52
Date: Mon, 02 Nov 2026 18:52
40 lines
3130 bytes
3130 bytes
On 11/02/2026 10:38 AM, Ross Finlayson wrote: > > C: a question about scope automatics in C > > 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. C++ of course has that's the usual way of > things with stack-allocation and block-scope for automatics, > I'm wondering if there's any way C makes it so (I think not, > yet would be glad to know so). > > > If not, are there common compiler extensions to so indicate > when a variable goes out of scope and make effects on it? > > Thanks for reading, also I'd be interested your opinion. > There's alloca which though only adjusts itself in stack-unwinding, then with regards to a compiler extension which modifies the AST about cleanup (basically for thread-locals and free-lists, those being the granularity of thread-locals for ownership and free-lists for resources), then though that there is signal-handling and about attaching any sort of behavior to what goes usually with automatics and alloca, not sure if any compiler-extensions make for giving and taking from the process-wide free-list, of page-size buffers for formatting temporaries among representations & manipulations & interpretations, of temporaries and automatics. I.e., attaching code to any exit-point of the function would still have signal-handlers to deal with. setjmp/longjmp?
Technical Details
Message-ID:
<2fadnQyNN9dvRnX3nZ2dnZfqn_GdnZ2d@giganews.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!border-2.nntp.ord.giganews.com!nntp.giganews.com!local-4.nntp.ord.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mailReferences:
<oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!border-2.nntp.ord.giganews.com!nntp.giganews.com!local-4.nntp.ord.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 02 Nov 2026 18:52:34 +0000 Subject: Re: C: a question about scope automatics in C Newsgroups: comp.lang.c References: <oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com> From: Ross Finlayson <ross.a.finlayson@gmail.com> Date: Mon, 2 Nov 2026 10:52:36 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <2fadnQyNN9dvRnX3nZ2dnZfqn_GdnZ2d@giganews.com> Lines: 40 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-OmVxzy/8vmEn0mS6NHHQ7JmRGy8PcpE5mUqRN5CCRRVamC176nEsf0Q3aYedgTFoef2T2IZG1Og6Sca!/EGrYdnyw2kabrEYSavnnsMiUQNyR9KNiO+rANFvnkTl04/8gUpTIrI8Z8pSub4qXtalUMV7uao= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40