🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1316

Re: C: a question about scope automatics in C

#1316
From: Lawrence D’Oliveiro
Date: Tue, 03 Nov 2026 23:12
25 lines
2785 bytes
On Tue, 3 Nov 2026 09:02:32 -0800, Ross Finlayson wrote:

> Then, if one of these records has some dozens, scores, or hundreds
> of fields, among textual, numeric, and calendric built-in and
> user-defined types, then each one of these might need a buffer or
> buffers the scratch-pad or working-memory, as the working-memory of
> the conversion & formatting routines, since for example strtok and
> strtok_r and other accounts of the conversion & formatting after the
> accessor/mutator routines of the records their fields in accounts of
> structured programming: are always using temporaries, here
> "automatic temporary arrays", their buffers.

Basically, a complex, dynamically-allocated data structure with an
intricate collection of components which themselves need dynamic
allocation? Need to deal with errors that might occur during the setup
and usage of such a structure, to ensure that all memory allocated is
properly freed, without the chance of double-frees or memory leaks?

Been there, done that. I use a technique called “structured
programming” to deal with the whole issue.

Have a look at this project:
<https://gitlab.com/ldo/a_structured_discipline_of_programming>. The
README gives an introduction to the concept, and the sample code
illustrates it in (I hope) exhaustive detail.
Technical Details
Message-ID: <11cdpo3$7e97$3@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: <oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com> <11cce4h$3m11i$1@dont-email.me> <8V2dnW6M3YIeZ3T3nZ2dnZfqn_SdnZ2d@giganews.com> <11cd0tn$3tbkg$1@dont-email.me> <mdicnZHlMZlPlXf3nZ2dnZfqnPednZ2d@giganews.com> <11cd22m$3tpfp$2@dont-email.me> <x8adnYBW_KQgjnf3nZ2dnZfqn_adnZ2d@giganews.com>

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.c
Subject: Re: C: a question about scope automatics in C
Date: Tue, 3 Nov 2026 23:12:03 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <11cdpo3$7e97$3@dont-email.me>
References: <oOScndMmgZhYRXX3nZ2dnZfqnPGdnZ2d@giganews.com>
	<11cce4h$3m11i$1@dont-email.me>
	<8V2dnW6M3YIeZ3T3nZ2dnZfqn_SdnZ2d@giganews.com>
	<11cd0tn$3tbkg$1@dont-email.me>
	<mdicnZHlMZlPlXf3nZ2dnZfqnPednZ2d@giganews.com>
	<11cd22m$3tpfp$2@dont-email.me>
	<x8adnYBW_KQgjnf3nZ2dnZfqn_adnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 03 Nov 2026 23:12:04 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="244007"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+4dF3a3SCyR909y9VjD8j9"; posting-host="b34ec214a2e04ef24d601d56ab9ea5cc"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:tPb1MbMTYDOYeroK9EMr4i/leg4= sha256:yPKbCV+asBd7wkY06kxuNHbw7clkkOhWLb9BTeJFol0=
	sha1:gAUHRmL/5oHbhPsgu0mKCfal6jA= sha256:16on7ff0wByQqhfde3ZdtieulOhcW4XzhCFSck7ksi0=