🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++
Article #397

Re: “The end of software secrecy is almost upon

#397
From: Chris M. Thomasson
Date: Mon, 26 Oct 2026 02:28
51 lines
4478 bytes
On 10/24/2026 3:32 PM, Lawrence D’Oliveiro wrote:
> I had a quick look at that. It seems to have to do with the reality of
> graphics hardware implementing different kinds of memory with
> different kinds of characteristics, and the impossibility of
> completely such ignoring such issues in real-time 3D rendering.
> 
> I expect higher-level APIs (e.g. game engines) will wrap all this
> behind their own higher-level abstractions, so regular
> programmers/game creators don’t have to worry about it.
> 
> In short, it’s an abstraction that leaks that you accept only because
> you have to, not because it’s a good idea for abstractions in general.
> If you can successfully hide issues of memory and other resource
> allocation behind your abstraction, you would still rather do it than
> not.
> 
> So, to get back to my point, the technique I use is based on a form of
> structured programming called a “Nassi-Shneiderman diagram”. The
> overall structure looks like
> 
>      ... initialize object pointer to NULL ...
>      do /*once*/
>        {
>          ... possible other stuff ...
>          ... allocate object pointer ...
>          if (error occurred)
>              break;
>          ... possible other stuff using object pointer ...
>        }
>      while (false);
>      ... call free(3) (or equivalent) on object pointer ...
> 
> So you can see there is no way out of the inner block without passing
> through the dispose call. Using gotos would contribute nothing except
> make it harder to assure yourself of the simplicity of the control
> flow.
> 
> Looks deceptively simple. But the same technique can scale up to quite
> complex cases.


The graphics case is where the leak is unavoidable, but that’s not why 
I’d want it. A lib that never allocates behind your back is what you 
want in embedded, kernel, and arena code, and a foo_create wrapper on 
top gives you the hidden-allocation version for everyone else. Your 
do-once cleanup idiom works fine with it. You just call deinit and 
reclaim the block the way you made it. It’s a way to structure the 
caller’s error handling, and it doesn’t say anything about who owns the 
memory.

Say memory on a threads stack, no free needed.
Technical Details
Message-ID: <11bmdri$5umm$1@dont-email.me>
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!.POSTED!not-for-mail
References: <11amvre$15far$1@dont-email.me> <11b5tdb$2cs5l$1@dont-email.me> <11b64cp$end$1@panix2.panix.com> <11b64hj$2faos$1@dont-email.me> <11b679m$6dl$1@panix2.panix.com> <11b6vc4$2npqv$1@dont-email.me> <11b87jg$37b7t$1@dont-email.me> <11b884b$p2o9$1@dont-email.me> <11b94he$3hdo3$2@dont-email.me> <11b9qd6$pq4i$1@dont-email.me> <11b9r5r$3nppf$1@dont-email.me> <11baekk$3v7n1$1@dont-email.me> <11bbl4f$du80$2@dont-email.me> <11bbo58$ek3q$1@dont-email.me> <11bbqns$fe31$1@dont-email.me> <11bbron$fmi2$1@dont-email.me> <11bc09b$gsv1$1@dont-email.me> <11bd6ed$ttau$1@dont-email.me> <11bejnh$1eab6$1@dont-email.me> <11berc9$1ge43$1@dont-email.me> <11bg0fa$1unku$1@dont-email.me> <11bgc00$23hkg$1@dont-email.me> <11bghmk$25qd0$1@dont-email.me> <11bgnsc$27pn2$2@dont-email.me> <11bgsgo$299in$4@dont-email.me> <11bh8ue$2coe1$1@dont-email.me> <11bj493$31thn$1@dont-email.me> <11bjbl3$340l8$6@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!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers
Subject: Re: “The end of software secrecy is almost upon
Date: Sun, 25 Oct 2026 19:28:00 -0700
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <11bmdri$5umm$1@dont-email.me>
References: <11amvre$15far$1@dont-email.me> <11b5tdb$2cs5l$1@dont-email.me>
 <11b64cp$end$1@panix2.panix.com> <11b64hj$2faos$1@dont-email.me>
 <11b679m$6dl$1@panix2.panix.com> <11b6vc4$2npqv$1@dont-email.me>
 <11b87jg$37b7t$1@dont-email.me> <11b884b$p2o9$1@dont-email.me>
 <11b94he$3hdo3$2@dont-email.me> <11b9qd6$pq4i$1@dont-email.me>
 <11b9r5r$3nppf$1@dont-email.me> <11baekk$3v7n1$1@dont-email.me>
 <11bbl4f$du80$2@dont-email.me> <11bbo58$ek3q$1@dont-email.me>
 <11bbqns$fe31$1@dont-email.me> <11bbron$fmi2$1@dont-email.me>
 <11bc09b$gsv1$1@dont-email.me> <11bd6ed$ttau$1@dont-email.me>
 <11bejnh$1eab6$1@dont-email.me> <11berc9$1ge43$1@dont-email.me>
 <11bg0fa$1unku$1@dont-email.me> <11bgc00$23hkg$1@dont-email.me>
 <11bghmk$25qd0$1@dont-email.me> <11bgnsc$27pn2$2@dont-email.me>
 <11bgsgo$299in$4@dont-email.me> <11bh8ue$2coe1$1@dont-email.me>
 <11bj493$31thn$1@dont-email.me> <11bjbl3$340l8$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 26 Oct 2026 02:28:03 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="195286"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18G3gFMgbsZyZanyS0qksd+AD6bBuxFzcs="; posting-host="49da529de1e605d0c2cf1bd5b7b86f4a"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:MzfR0q5IaKnBK2BOBDlMpmrD1/0= sha256:EjdFaAgy8Js8NHsq2P6PnSSMl8xiLRKICpsHcTtZkhg=
	sha1:5JFenoKTUsQOskxl++3n8+b38bs= sha256:RAZyy0NuqlBBRj5KCy2dOCXoX7fcyUII7dOSmLktfwo=
Content-Language: en-US
In-Reply-To: <11bjbl3$340l8$6@dont-email.me>