Article View: comp.lang.c
Article #1284Re: C: a question about scope automatics in C
From: Ross Finlayson
Date: Tue, 03 Nov 2026 01:37
Date: Tue, 03 Nov 2026 01:37
111 lines
6290 bytes
6290 bytes
On 11/02/2026 02:42 PM, bartc wrote: > On 02/11/2026 22:27, Ross Finlayson wrote: >> On 11/02/2026 01:53 PM, Michael S wrote: >>> On Mon, 2 Nov 2026 10:38:44 -0800 >>> Ross Finlayson <ross.a.finlayson@gmail.com> 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. >>>> >>> >>> If you or somebody else translates your question to English, it will >>> greatly increase your chance of getting the answer. >>> >> >> What's in mind is a sort of, "superset", of the language, >> about a sort of, "least-ledge automatic temporary arrays", >> basically making interpretations of the storage-class, >> about declaring arrays as would be in the usual data-segment >> storage-class, while realizing them in the stack-segment storage-class, >> according to "convention & idiom & discipline" and "the __attribute__ >> extension-point__ & compiler-plugins", as is detailed further in >> the other post on this thread where it was put through the wringer. >> >> >> Basically, when dealing with, "scanning & parsing", or extracting >> values from text-strings and formatting values into text strings, >> is about the temporaries and the automatic temporaries or local >> variables as they're called, is figuring at compile-time to count >> up and disambiguate the dependencies and uses of those as temporaries, >> while imposing a sort of bound about "PAGE_SIZE" which you know, >> to have real clean un-cluttered to test like with fixed-length-arrays >> the usual way to declare data in the data-segment, while when compiled >> to be used as a module or library, or in the runtime, with the >> re-entrant, to sort of be both _fast_ and _small_, and moreso, >> what's a compile-time invariant the size. >> >> So, since today, "C-llata". >> >> Sort of rhymes with "c u later", or "chocolate latte". > > Sort of rhymes with 'complete bollocks'. What doesn't. What I wonder is what is "incomplete bollocks" anyways. Non-bollocks? Pseudo-bollocks? Undescended-bollocks? If "bollocks" is to Briticisms and it's fair to call that English and proper English and so on, as "cabron" is to Spanglisms, if you're familiar with Spanglish, then what I want is fixed-size buffers in re-entrant code that automatically clean themselves up, while still just writing plain-looking buffers with perhaps a little tag, and hopefully nothing. __attribute(llata)__ /* <- this bit */ #define LA _attribute(llata)__ /* LA = "local array" */ #LA char buf1[PAGE_SIZE] #LA char buf2[PAGE_SIZE] strncat(buf1, "Stuff", PAGE_SIZE); strncat(buf2, "More" , PAGE_SIZE); strncat(buf1, buf2, PAGE_SIZE); Then, I want to compile that from a test-runner and have it run as though it's from the data-segment, and compile that into a module and run it as from the buffers in the stack-segment so that it's re-entrant, re-purposing the machinery, re-using the code, and without much or at all instrumenting the code. Targeting POSIX and its implementations according to GCC et alia. It's like the other day there was another new little language that makes all the world a slab-allocator off the stack-segment, or "goose" it's called, and it's like, why not in "C"? What's good for the "goose", .... Then, since on the one hand it's interacting with string functions, so needs look like C-strings, and needs limits so to avoid injection attacks, and if the thread dies it can't leak, so can't malloc, and on the other hand it's interacting with I/O callbacks, and would need to copy off buffer-to-buffer, so to be aligning those and making them the same size, first was for accounts of free-lists as reference-counting of things that are only used once by one, or handed off and never shared, then got to be about stack cleanup and, ..., "in the language". Thanks for writing.
Technical Details
Message-ID:
<XsecnQmQfKdfp3T3nZ2dnZfqn_udnZ2d@giganews.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.14.MISMATCH!border-1.nntp.ord.giganews.com!nntp.giganews.com!local-3.nntp.ord.giganews.com!Xl.tags.giganews.com!local-4.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mailReferences:
<oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com> <20261102235348.000056e9@yahoo.com> <9VKdnTXwXLb-k3T3nZ2dnZfqn_SdnZ2d@giganews.com> <11cb3k5$39naq$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.14.MISMATCH!border-1.nntp.ord.giganews.com!nntp.giganews.com!local-3.nntp.ord.giganews.com!Xl.tags.giganews.com!local-4.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 03 Nov 2026 01:37:06 +0000 Subject: Re: C: a question about scope automatics in C Newsgroups: comp.lang.c References: <oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com> <20261102235348.000056e9@yahoo.com> <9VKdnTXwXLb-k3T3nZ2dnZfqn_SdnZ2d@giganews.com> <11cb3k5$39naq$1@dont-email.me> From: Ross Finlayson <ross.a.finlayson@gmail.com> Date: Mon, 2 Nov 2026 17:37:02 -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: <11cb3k5$39naq$1@dont-email.me> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <XsecnQmQfKdfp3T3nZ2dnZfqn_udnZ2d@giganews.com> Lines: 111 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-g59ZUuYjC6eHlna+AuC9nzdx2FGBOr49zv8ARZ9VV6Q5IBjz7gYJX+KRHIoPxDhASWHoMpr/GVMu4Lg!FPkOxkN1rfQ94jGHOvfHuzviOo8XcsWZaO8i270FGmHAR2URB7mTrtlhS0av/r39IQPTF7cbmpc= 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