Article View: comp.lang.c++
Article #125Re: “The end of software secrecy is almost upon
From: Lawrence D’Oliveiro
Date: Wed, 21 Oct 2026 05:35
Date: Wed, 21 Oct 2026 05:35
29 lines
3095 bytes
3095 bytes
On Wed, 21 Oct 2026 03:22:12 GMT, Charlie Gibbs wrote: > On 2026-10-21, Lawrence D’Oliveiro <ldo@nz.invalid> wrote: > >> On Tue, 20 Oct 2026 23:18:44 GMT, Charlie Gibbs wrote: >> >>> I know that a lot of CS types are going to stick pins into little >>> dolls that look like me for saying this, but IMHO resource >>> pointers, handles, etc. should be global. >> >> Surely any variable which is only used locally to a particular >> block should be declared local to that block. Why should resource >> pointers be any different? > > Many resource pointers aren't local, though. Consider a program > which loads a table from a file, then uses it for lookups while > processing data in another file. You might decompose the program > into a function that loads the table, and another that performs > lookups. The main routine calls the table load routine, and opens > the file to be processed. It then loops reading records, calling the > lookup function each time. The table, dynamically allocated by the > table load function, must remain allocated when the allocator exits, > and must be available to the lookup function on each call; it cannot > be local to either of those functions. This is why OO was invented. You instantiate a Table instance, and that loads the table contents. Call the lookup method on the instance as many times as you need. Then, when finished with the Table instance, dispose of it.
Technical Details
Message-ID:
<11b9ivc$3l77q$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-mailReferences:
<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> <11b6u68$2neta$1@dont-email.me> <11b6v90$2nine$3@dont-email.me> <11b87t8$379mv$1@dont-email.me> <11b8b2k$p44i$1@dont-email.me> <rXOBS.7015$5Iy.3911@fx04.iad> <11b8h83$3b48o$1@dont-email.me> <oFSBS.93666$Q3f.6740@fx05.iad> <11b94e3$3hdo3$1@dont-email.me> <EdWBS.93422$TYg.8089@fx21.iad>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: Wed, 21 Oct 2026 05:35:40 -0000 (UTC) Organization: A noiseless patient Spider Lines: 29 Message-ID: <11b9ivc$3l77q$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> <11b6u68$2neta$1@dont-email.me> <11b6v90$2nine$3@dont-email.me> <11b87t8$379mv$1@dont-email.me> <11b8b2k$p44i$1@dont-email.me> <rXOBS.7015$5Iy.3911@fx04.iad> <11b8h83$3b48o$1@dont-email.me> <oFSBS.93666$Q3f.6740@fx05.iad> <11b94e3$3hdo3$1@dont-email.me> <EdWBS.93422$TYg.8089@fx21.iad> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 21 Oct 2026 05:35:41 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3841274"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19v2rTP02jQ9i5qaK7SbRrM"; posting-host="14e2b17baad9bafcbc21d2e918d6f68a" User-Agent: Pan/0.165 (Kostiantynivka) Cancel-Lock: sha1:+OCDkFJ6dKrZEeIpZ128kfrDMhg= sha256:vl610igebGLLtf09F4iaRsD8E9tMPsPbyVSkKDE9rKw= sha1:ERzZPogE13nTR+Q/pmBiZ81tm2Y= sha256:+CrTvVkslpcY6Gl+TCO9YPWgUKudtjbRNcvZjgtAO1A=