🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: “The end of software secrecy is almost upon

#337
From: Lawrence D’Oliveiro
Date: Sat, 24 Oct 2026 22:32
67 lines
4883 bytes
On Sat, 24 Oct 2026 13:26:07 -0700, Chris M. Thomasson wrote:

> On 10/23/2026 8:33 PM, Lawrence D’Oliveiro wrote:
>>
>> On Fri, 23 Oct 2026 17:01:28 -0700, Chris M. Thomasson wrote:
>>
>>> On 10/23/2026 3:42 PM, Lawrence D’Oliveiro wrote:
>>>>
>>>> The whole aim of levels of abstraction is to tame the
>>>> multi-headed beast of complexity that is computer programming.
>>>> What you are doing here is breaking down those levels, all in the
>>>> aid of, I don’t know, just to keep using gotos in your code, or
>>>> something.
>>>
>>> Well, not about goto's and such. Just so a lib can inform the
>>> caller as to what it needs to work with. The caller sets it up,
>>> then calls into the init etc. Its being used in a lot of places.
>>> Take Vulkan.
>>
>> Where in Vulkan? Exposing implementation details to the caller not
>> only increases complexity, it also limits the implementor’s ability
>> to change those details later.
>
> Iiic, vkGetBufferMemoryRequirements and
> vkGetImageMemoryRequirements, which return a VkMemoryRequirements
> struct containing size, alignment, and memoryTypeBits. The caller
> allocates the memory with vkAllocateMemory and binds it with
> vkBindBufferMemory.

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.
Technical Details
Message-ID: <11bjbl3$340l8$6@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>

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: Lawrence D’Oliveiro <ldo@nz.invalid>
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: Sat, 24 Oct 2026 22:32:03 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <11bjbl3$340l8$6@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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 24 Oct 2026 22:32:04 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3277480"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/TK0vexnNIQo0/gDzWeZM4"; posting-host="2f0c6f23b3422283e8fcbe6e904c474e"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:nLwqD/8fc4diRsVmFZdf1ZKGf6Y= sha256:dkiwvJBaf1G1nFQlIWJcWWJiq90GcgTJMSdu2AqlY2Q=
	sha1:6G8Ev6+klFZ48ICa0dxsacYJdxY= sha256:ghJSdTdhdT2aOT0HdLB8OCW1I7RgU1q3935inwz009M=