Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Patch griefs with proverbs. -- William Shakespeare, "Much Ado About Nothing"


comp / comp.os.linux.misc / Re: Joy of this, Joy of that

SubjectAuthor
* Joy of this, Joy of thatroot
+* Re: Joy of this, Joy of thatLawrence D'Oliveiro
|`* Re: Joy of this, Joy of thatroot
| +- Re: Joy of this, Joy of thatLawrence D'Oliveiro
| `- Re: Joy of this, Joy of thatrbowman
`* Re: Joy of this, Joy of that186282@ud0s4.net
 +* Re: Joy of this, Joy of thatRich
 |+- Re: Joy of this, Joy of thatThe Natural Philosopher
 |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | +* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |`- Re: Joy of this, Joy of thatBozo User
 | +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |`* Re: Joy of this, Joy of thatDon_from_AZ
 | | `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |  `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |   +* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |   |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |   | +* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |   | |`- Re: Joy of this, Joy of that186282@ud0s4.net
 | |   | `- Re: Joy of this, Joy of thatrbowman
 | |   `* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |    +- Re: Joy of this, Joy of thatrbowman
 | |    +* Re: Joy of this, Joy of thatLouis Krupp
 | |    |`- Re: Joy of this, Joy of thatRich
 | |    +- Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |    `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |     +- Re: Joy of this, Joy of thatrbowman
 | |     `* Re: Joy of this, Joy of thatRich
 | |      +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      |+* Re: Joy of this, Joy of thatRich
 | |      ||`* Re: Joy of this, Joy of thatD
 | |      || `* Re: Joy of this, Joy of thatrbowman
 | |      ||  `* Re: Joy of this, Joy of thatD
 | |      ||   `* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||    +* Re: Joy of this, Joy of thatD
 | |      ||    |`* Re: Joy of this, Joy of thatrbowman
 | |      ||    | +- Re: Joy of this, Joy of thatD
 | |      ||    | `* Re: Joy of this, Joy of thatPancho
 | |      ||    |  `* Re: Joy of this, Joy of thatRich
 | |      ||    |   +* Re: Joy of this, Joy of thatChris Ahlstrom
 | |      ||    |   |`- Re: Joy of this, Joy of thatPancho
 | |      ||    |   `* Re: Joy of this, Joy of thatrbowman
 | |      ||    |    +* Re: Joy of this, Joy of thatD
 | |      ||    |    |+- Re: Joy of this, Joy of thatRich
 | |      ||    |    |`* Re: Joy of this, Joy of thatrbowman
 | |      ||    |    | `- Re: Joy of this, Joy of thatD
 | |      ||    |    `* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||    |     `* Re: Joy of this, Joy of thatrbowman
 | |      ||    |      `- Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||    `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||     `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||      `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||       `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        +* Re: Joy of this, Joy of thatrbowman
 | |      ||        |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        | +* Re: Joy of this, Joy of thatrbowman
 | |      ||        | |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        | | `- Re: Joy of this, Joy of thatrbowman
 | |      ||        | `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |  `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   +* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   | +- Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |   | `* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |  +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |  |`- Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |   |  `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |   +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |   |+* Re: Joy of this, Joy of thatRich
 | |      ||        |   |   ||`- Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |   |+- Re: Joy of this, Joy of thatD
 | |      ||        |   |   |`- Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |   +* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |   |   |`- Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |   `* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |    `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |     +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |     |`- Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |     `* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |      `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       +* Re: Joy of this, Joy of thatD
 | |      ||        |   |       |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | +* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |       | |+* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | ||+* Re: Joy of this, Joy of thatCharlie Gibbs
 | |      ||        |   |       | |||+* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | ||||`* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| +* Re: Joy of this, Joy of thatRich
 | |      ||        |   |       | |||| |`* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| | `* Re: Joy of this, Joy of thatRich
 | |      ||        |   |       | |||| |  +* Re: Joy of this, Joy of thatCharlie Gibbs
 | |      ||        |   |       | |||| |  |`- Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| |  `* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| |   +* Re: Joy of this, Joy of thatRich
 | |      ||        |   |       | |||| |   |+* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |       | |||| |   ||`* Re: Joy of this, Joy of thatRich
 | |      ||        |   |       | |||| |   || +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |       | |||| |   || |`* Re: Joy of this, Joy of thatCharlie Gibbs
 | |      ||        |   |       | |||| |   || | `- Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |       | |||| |   || +- Re: Joy of this, Joy of thatCharlie Gibbs
 | |      ||        |   |       | |||| |   || `- Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |       | |||| |   |`- Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| |   `* Re: Joy of this, Joy of thatRobert Riches
 | |      ||        |   |       | |||| `- Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | |||`* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | ||`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | `* Re: Joy of this, Joy of thatD
 | |      ||        |   |       `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |   `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      |`* Re: Joy of this, Joy of thatvallor
 | |      `* Re: Joy of this, Joy of thatD
 | `- Re: Joy of this, Joy of thatRich
 +* Re: Joy of this, Joy of thatJohn Ames
 `- Re: Joy of this, Joy of thatrbowman

Pages:12345678910111213141516171819202122232425262728293031323334
Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 20:55 UTC
References: 1 2 3 4 5 6 7 8
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Fri, 22 Nov 2024 20:55:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <vhqr3t$1b2t7$7@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 22 Nov 2024 21:55:26 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d0640d653b3828f8761808e02c741927";
logging-data="1412007"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2BQVSnaaTZVlWL0gRLqnS"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:GR90SrzDhjKRccFCak+sHIVhGsk=
View all headers

On Fri, 22 Nov 2024 10:45:58 +0000, Richard Kettlewell wrote:

> More recent languages have other options (‘defer’, ‘finally’,
> destructors, etc).

And then there are “continuations”. You find these in Scheme, not so much
in other languages. They are a generalized control construct. They can be
used to implement looping-with-multiple-exits, exceptions and coroutines,
but not (easily) for arbitrary gotos.

In other words, you can consider them to be a generalized *structured*
control construct.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 20:58 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Fri, 22 Nov 2024 20:58:31 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <vhqr9n$1b2t7$8@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 22 Nov 2024 21:58:31 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d0640d653b3828f8761808e02c741927";
logging-data="1412007"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EOI0j9mdqJZDlsnvozFeh"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:mE29PCqKAdMhzJI89Tig/R5qISc=
View all headers

On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote:

> All my programs contain a routine called quit_cleanup(); it takes a
> single argument, which is either an error message or NULL.
> It frees all allocated memory, closes any open files, etc.

But all that is unnecessary if your program is terminating anyway.

In *nix C code, a common convention is

if («call failed»)
{
perror(«doing what»);
exit(«nonzero error code»);
} /*if*/

<https://manpages.debian.org/3/perror.3.en.html>

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 21:02 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Fri, 22 Nov 2024 21:02:22 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <vhqrgu$1b2t7$9@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 22 Nov 2024 22:02:22 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d0640d653b3828f8761808e02c741927";
logging-data="1412007"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fhLJaamgOyBvM0oltJi2m"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:9guWM8KcbtgcwV5ALifaUSl6u30=
View all headers

On Fri, 22 Nov 2024 13:37:43 +0000, Pancho wrote:

> In OO, switch/case statements were deprecated too :-) I can't remember
> exactly why. I think it was because we were supposed to use polymorphism
> instead.

Switch/case expressions? With cases based on different types, perhaps?

info_type = infoptr.contents.info_type
infoptr = ct.cast \
(
infoptr,
ct.POINTER
(
{
FANOTIFY.EVENT_INFO_TYPE_FID : FANOTIFY.event_info_fid,
FANOTIFY.EVENT_INFO_TYPE_DFID_NAME : FANOTIFY.event_info_fid,
FANOTIFY.EVENT_INFO_TYPE_DFID : FANOTIFY.event_info_fid,
FANOTIFY.EVENT_INFO_TYPE_PIDFD : FANOTIFY.event_info_pidfd,
FANOTIFY.EVENT_INFO_TYPE_ERROR : FANOTIFY.event_info_error,
}[info_type]
)
)
additional.append(infoptr)
if info_type == FANOTIFY.EVENT_INFO_TYPE_DFID_NAME :
nameptr = ct.cast \
(
ct.cast(infoptr, ct.c_void_p).value
+
ct.sizeof(FANOTIFY.event_info_fid)
+
infoptr.contents.handle.handle_bytes,
ct.c_char_p
)
additional.append(nameptr.value)
#end if
next += infolen
remaining -= infolen

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 21:03 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Fri, 22 Nov 2024 21:03:52 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <vhqrjn$1b2t7$10@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 22 Nov 2024 22:03:52 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d0640d653b3828f8761808e02c741927";
logging-data="1412007"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tP7JstjgB3izSiHasXjDZ"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:H0vHDiKlq1FRWVEhehkGiYzIIuQ=
View all headers

On Fri, 22 Nov 2024 19:30:24 +0000, The Natural Philosopher wrote:

> The 'nogoto' was really a fool's rule.

I have never written a goto in (production) C code.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 21:04 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Fri, 22 Nov 2024 21:04:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <vhqrli$1b2t7$11@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me>
<0OCcnUL4TZF9Q6L6nZ2dnZfqn_WdnZ2d@earthlink.com>
<Jq40P.70905$EQue.45224@fx13.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 22 Nov 2024 22:04:50 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d0640d653b3828f8761808e02c741927";
logging-data="1412007"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/n7Mx4ykv60BI6d3YKd27Q"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:f0nNKr8IQV1x9lO881hCJlRe0dE=
View all headers

On Fri, 22 Nov 2024 18:53:29 GMT, Charlie Gibbs wrote:

> After all, what is a subroutine call other than a
> GOTO paired with a "come from"?

A stack of call frames and return addresses.

LIFO discipline applies.

Subject: Re: Joy of this, Joy of that
From: Pancho
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 23:07 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Pancho.Jones@proton.me (Pancho)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Fri, 22 Nov 2024 23:07:19 +0000
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <vhr2r7$1cdln$1@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 00:07:19 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0996b149b2c257ae77a172fc1c1f1afd";
logging-data="1455799"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PObW0iO2y3MwUuhMQdYFGW/H6C+sx2/c="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:vfNZ1gLVQLdedvn0rsY1Sk46ujM=
In-Reply-To: <vhqm4g$1aarf$1@dont-email.me>
Content-Language: en-GB
View all headers

On 11/22/24 19:30, The Natural Philosopher wrote:

>> Coding is always a balance between flexibility and clarity, there is
>> no "right" answer. You can make code more flexible by adding another
>> layer of indirection, but it becomes harder to understand.
>>
>>
> I echo that. The 'nogoto' was really a fool's rule. The wise man's
> guidance was 'make it clear what you are doing because you  or someone
> else - may need to understand it in a years time'
> I dpnt find OO in general makes code easier to understand.
>

It's hard for me to understand reluctance to use OO. I learnt Smalltalk
before I learnt C. I never did much development in C, mainly
maintenance, but when I did it had an OO feel. When C++ came along I was
very happy.

To me saying you don't like OO is a bit like saying you don't like
structs. Yes, instead of a struct you could use a block of memory and
offsets, but why would you want to when you have a struct.

I find it hard to imagine any other way of coding.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 00:44 UTC
References: 1 2 3 4 5 6 7 8 9 10 11
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 00:44:34 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <vhr8hh$1ddh7$2@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 01:44:34 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1488423"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Js6/wfUcEUg0wwfkvrG7h"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:wxM47quE2SjwbgsGvRbdd4gtK6s=
View all headers

On Fri, 22 Nov 2024 23:07:19 +0000, Pancho wrote:

> I learnt Smalltalk before I learnt C.

Smalltalk is an interesting language. But I think it’s considered a little
too unconventional these days ...

Does it do multiple inheritance? I can’t remember.

Subject: Re: Joy of this, Joy of that
From: Pancho
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 01:08 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Pancho.Jones@proton.me (Pancho)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 01:08:16 +0000
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <vhr9u1$1dh3s$1@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 02:08:18 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0996b149b2c257ae77a172fc1c1f1afd";
logging-data="1492092"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+xIIBw0vkkrawHEcQgbrQ6wb4eovP4BrQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:t0YG41LloFPQf5giLdMJaaApbKg=
In-Reply-To: <vhr8hh$1ddh7$2@dont-email.me>
Content-Language: en-GB
View all headers

On 11/23/24 00:44, Lawrence D'Oliveiro wrote:
> On Fri, 22 Nov 2024 23:07:19 +0000, Pancho wrote:
>
>> I learnt Smalltalk before I learnt C.
>
> Smalltalk is an interesting language. But I think it’s considered a little
> too unconventional these days ...
>
> Does it do multiple inheritance? I can’t remember.

No, not that I remember. Classes, Metaclasses, Single inheritance, very
clean. I think Smalltalk was more a teaching tool rather than anything
people used commercially. It was early enough in my development that OO
concepts were like a first language to me. Perhaps if I had had a solid
coding background in something like C before being introduced to OO, I
would think differently.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 01:41 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 01:41:47 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <vhrbsr$1dqca$2@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 02:41:48 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1501578"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uiLBmlIJiC8hIAph4PotP"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:58lsUYtfDfR0655IJq8fGMlBkYc=
View all headers

On Sat, 23 Nov 2024 01:08:16 +0000, Pancho wrote:

> On 11/23/24 00:44, Lawrence D'Oliveiro wrote:
>>
>> On Fri, 22 Nov 2024 23:07:19 +0000, Pancho wrote:
>>
>>> I learnt Smalltalk before I learnt C.
>>
>> Smalltalk is an interesting language. But I think it’s considered a
>> little too unconventional these days ...
>>
>> Does it do multiple inheritance? I can’t remember.
>
> No, not that I remember. Classes, Metaclasses, Single inheritance, very
> clean.

“Metaclasses” were just a bit of a hack to implement what Python would
call “classmethods”. Python also has “metaclasses”, in the sense that
classes, being first-class objects, must be instances of something -- and
that something is the metaclass.

Not sure if any other language has that meaning for “metaclass”.

> I think Smalltalk was more a teaching tool rather than anything
> people used commercially.

I’m pretty sure it has been used commercially, back in the 1980s or
so, maybe even the 1990s. I found a mention of a game framework
originally written in Squeak
<https://www.theregister.com/2023/03/23/croquet_for_unity/>, though
the main news in the article is that it had been reworked in ... wait
for it ... JavaScript.

Subject: Re: Joy of this, Joy of that
From: rbowman
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 02:29 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bowman@montana.com (rbowman)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: 23 Nov 2024 02:29:18 GMT
Lines: 42
Message-ID: <lqcsvtFiao0U1@mid.individual.net>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net eBMazpvUiZ9LZ81HUCwraAv7xfMczeK2uPzamuR1skLwrICWHs
Cancel-Lock: sha1:XGmKnPkvYJfq7ja3/xwLUztN2/E= sha256:nXbWWZIvLRWi0qQSVcH/fBdNmV1arLEJBenjNg8h6Fs=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
View all headers

On Sat, 23 Nov 2024 01:08:16 +0000, Pancho wrote:

> On 11/23/24 00:44, Lawrence D'Oliveiro wrote:
>> On Fri, 22 Nov 2024 23:07:19 +0000, Pancho wrote:
>>
>>> I learnt Smalltalk before I learnt C.
>>
>> Smalltalk is an interesting language. But I think it’s considered a
>> little too unconventional these days ...
>>
>> Does it do multiple inheritance? I can’t remember.
>
> No, not that I remember. Classes, Metaclasses, Single inheritance, very
> clean. I think Smalltalk was more a teaching tool rather than anything
> people used commercially. It was early enough in my development that OO
> concepts were like a first language to me. Perhaps if I had had a solid
> coding background in something like C before being introduced to OO, I
> would think differently.

A person's experience is definitely a factor. My first language was
FORTRAN IV although I never did much with it. As microcontrollers started
to appear in industrial applications I mostly worked wiht assembly or C,
viewing C very much as an abstraction of assembly.

The Boston branch of the IEEE Computer Society was quite active and I
recall discussions of 'C with Classes' in the early '80s that eventually
became C++.

I think C++ was a premature birth. Stroustrup's first and second editions
used objects sparingly compared to what many of the popular texts did when
trying to illustrate inheritance, polymorphism, and so forth. The STL and
Standard Library were years in the future so you had companies like
Microsoft coming up with MFC. Then there was Stroustrup's little quip
about C++ making it difficult to shoot yourself in the foot but when you
did you blew your whole leg off.

Esri used C++ for their Arc Objects API so I used C++ but it never became
my favorite language and the C++ part was mostly manipulating the objects
rather than overall structure. I use C# and Python so I don't dislike OO
when used sparingly. I might even like C++ these days although I have no
call to use it. When our department moved I looked through my dusty C++
reference books from 25 years ago and realized they are museum relics.

Subject: Re: Joy of this, Joy of that
From: 186282@ud0s4.net
Newsgroups: comp.os.linux.misc
Organization: wokiesux
Date: Sat, 23 Nov 2024 04:57 UTC
References: 1 2 3 4 5 6 7
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 23 Nov 2024 04:57:59 +0000
Subject: Re: Joy of this, Joy of that
Newsgroups: comp.os.linux.misc
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<vhl090$5ghq$1@dont-email.me>
<w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com>
<vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid>
<vhp646$12c7u$1@dont-email.me>
From: 186283@ud0s4.net (186282@ud0s4.net)
Organization: wokiesux
Date: Fri, 22 Nov 2024 23:57:58 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <vhp646$12c7u$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
Lines: 36
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 99.101.150.97
X-Trace: sv3-YgFC2RaQDjmhg/2l02pDBXGdpZEVt05+Sd02qILVXN7aoDNIhtb/u8qonOfrC6p79qb0WJjuIR5FAXq!cMFXJ8yzZ+mFu6+hMqLHwxpnPgkdaCkd5fXT/dkN9GG7Zqi+lWbqAjj2KxzyVM4afi7wefYMxGij!aGVaXcfCP3zNEx/9Pec7
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
View all headers

On 11/22/24 12:51 AM, Lawrence D'Oliveiro wrote:
> On Thu, 21 Nov 2024 20:19:55 -0700, Don_from_AZ wrote:
>
>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>
>>> On 21/11/2024 07:20, 186282@ud0s4.net wrote:
>>>>
>>>> I take it you're also not a fan of Perl  🙂
>>>
>>> Perfectly Execrable Rubbish Language
>>
>> I've heard it called:
>>
>> "Pathologically Eclectic Rubbish Lister"
>
> It changed the meaning of the term “high-level language” forever.

Well ... glad to see my opinion of Perl is
not unique :-)

Way back I bought the usual "Learn Perl" book with
the camel on the front. About two chapters in I
said "WHY ???".

I've had to tweak a few Perl scripts that for
SOME reason other developers used in their apps,
but it's NOT pleasant. As I remember "ZoneMinder"
uses some Perl - and sometimes you need to tweak
some lines to get best performance ......

ZM is a pretty good app - but CAN be a horrible
CPU/mem hog if you don't set everything perfectly.
The docs are only JUST so good at explaining how
to set everything perfectly ....

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 05:31 UTC
References: 1 2 3 4 5 6 7 8
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 05:31:51 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <vhrpc7$1jata$2@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<vhl090$5ghq$1@dont-email.me>
<w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com>
<vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid>
<vhp646$12c7u$1@dont-email.me>
<pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 06:31:51 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1682346"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sJ2rIfIc+DfYJaDHQBiH2"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:bB4o0BXNpIip/RybrcsTGC2ntBs=
View all headers

On Fri, 22 Nov 2024 23:57:58 -0500, 186282@ud0s4.net wrote:

> Way back I bought the usual "Learn Perl" book with the camel on the
> front. About two chapters in I said "WHY ???".

Perl was designed by a bunch of clever people, who understood the sort of
features they wanted to add. The trouble is, they did it in kind of an ad-
hoc way, so the syntax, like Topsy, “just growed”.

Subject: Re: Joy of this, Joy of that
From: 186282@ud0s4.net
Newsgroups: comp.os.linux.misc
Organization: wokiesux
Date: Sat, 23 Nov 2024 06:28 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!border-1.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 23 Nov 2024 06:28:45 +0000
Subject: Re: Joy of this, Joy of that
Newsgroups: comp.os.linux.misc
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
From: 186283@ud0s4.net (186282@ud0s4.net)
Organization: wokiesux
Date: Sat, 23 Nov 2024 01:28:45 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <Iq40P.70904$EQue.62359@fx13.iad>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <Oo6dnZH3z-OA69z6nZ2dnZfqnPcAAAAA@earthlink.com>
Lines: 25
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 99.101.150.97
X-Trace: sv3-RBlCjGnWwz7OlkYZCXBE3RxMC58kdwORpdWqDKUDvPYFZfW/ftES8PG+MGOReJaI9SRFoZrTgKBb8QR!CPogm6S+kv+c1ZtMQeQ+NOgRYYoURd+Qsz8xyMS7vAvHTozdtg6kVEpB8Z6Izr5jyqQcBes1dxq6!V8cgHiYUwizSKK4PeMx0
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
View all headers

On 11/22/24 1:53 PM, Charlie Gibbs wrote:
> On 2024-11-22, The Natural Philosopher <tnp@invalid.invalid> wrote:
>
>> On 22/11/2024 10:45, Richard Kettlewell wrote:
>>
>>> The one place I’ll use a goto (in C) is to branch to unified cleanup
>>> code in an error case, usually using a macro both to emphasize what’s
>>> going on and to stop the error-handling guff from dominating what the
>>> reader sees.
>>
>> +1
>> GOTO snafu_nuclear_option... :-)
>
> All my programs contain a routine called quit_cleanup(); it takes
> a single argument, which is either an error message or NULL.
> It frees all allocated memory, closes any open files, etc.
> (all such variables are global and I initialize them to NULL
> or whatever other value is appropriate). Then, if the error
> message argument is not NULL, it displays and/or logs the
> message and calls exit() with a non-zero argument. If the
> error message argument is NULL, it simply calls exit(0).
> I can call it from anywhere, and it guarantees an orderly shutdown.

Seems wise.

Subject: Re: Joy of this, Joy of that
From: Charlie Gibbs
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 07:09 UTC
References: 1 2 3 4 5 6 7 8 9 10 11
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!news.quux.org!weretis.net!feeder9.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx16.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgibbs@kltpzyxm.invalid (Charlie Gibbs)
Subject: Re: Joy of this, Joy of that
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
User-Agent: slrn/1.0.3 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 43
Message-ID: <mcf0P.211278$pZ%.68099@fx16.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sat, 23 Nov 2024 07:09:06 UTC
Date: Sat, 23 Nov 2024 07:09:06 GMT
X-Received-Bytes: 2916
View all headers

On 2024-11-22, candycanearter07
<candycanearter07@candycanearter07.nomail.afraid> wrote:

> Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote at 18:53 this Friday (GMT):
>
>> On 2024-11-22, The Natural Philosopher <tnp@invalid.invalid> wrote:
>>
>>> On 22/11/2024 10:45, Richard Kettlewell wrote:
>>>
>>>> The one place I’ll use a goto (in C) is to branch to unified cleanup
>>>> code in an error case, usually using a macro both to emphasize what’s
>>>> going on and to stop the error-handling guff from dominating what the
>>>> reader sees.
>>>
>>> +1
>>> GOTO snafu_nuclear_option... :-)
>>
>> All my programs contain a routine called quit_cleanup(); it takes
>> a single argument, which is either an error message or NULL.
>> It frees all allocated memory, closes any open files, etc.
>> (all such variables are global and I initialize them to NULL
>> or whatever other value is appropriate). Then, if the error
>> message argument is not NULL, it displays and/or logs the
>> message and calls exit() with a non-zero argument. If the
>> error message argument is NULL, it simply calls exit(0).
>> I can call it from anywhere, and it guarantees an orderly shutdown.
>
> Unless you specifically use your own allocation wrapper that adds it to
> an internal list, how do you deallocate "all" the allocations you've
> done?

I've occasionally considered making a list, but never got around to
implementing such a scheme. So it's the good old-fashioned way -
free each allocation one by one and hope you don't forget one.
Even then, leaks would be unlikely, because I try to close or free
resources as soon as I'm done with them, and the de-allocations
in quit_cleanup() are mostly belt-and-suspenders code.

--
/~\ Charlie Gibbs | Growth for the sake of
\ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
X I'm really at ac.dekanfrus | of the cancer cell.
/ \ if you read it the right way. | -- Edward Abbey

Subject: Re: Joy of this, Joy of that
From: Charlie Gibbs
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 07:09 UTC
References: 1 2 3 4 5 6 7 8 9 10 11
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx16.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgibbs@kltpzyxm.invalid (Charlie Gibbs)
Subject: Re: Joy of this, Joy of that
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhqrjn$1b2t7$10@dont-email.me>
User-Agent: slrn/1.0.3 (Linux)
Lines: 19
Message-ID: <ocf0P.211279$pZ%.119177@fx16.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sat, 23 Nov 2024 07:09:08 UTC
Date: Sat, 23 Nov 2024 07:09:08 GMT
X-Received-Bytes: 1578
View all headers

On 2024-11-22, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

> On Fri, 22 Nov 2024 19:30:24 +0000, The Natural Philosopher wrote:
>
>> The 'nogoto' was really a fool's rule.
>
> I have never written a goto in (production) C code.

I have two in a large old production program - well, actually
12, but there are only two target labels. Someday I might
get around to re-working the code to eliminate them, but
there's always something else to do first, and that part
of the program has been stable for 30 years.

--
/~\ Charlie Gibbs | Growth for the sake of
\ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
X I'm really at ac.dekanfrus | of the cancer cell.
/ \ if you read it the right way. | -- Edward Abbey

Subject: Re: Joy of this, Joy of that
From: Charlie Gibbs
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 07:09 UTC
References: 1 2 3 4 5 6 7 8 9 10 11
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx16.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgibbs@kltpzyxm.invalid (Charlie Gibbs)
Subject: Re: Joy of this, Joy of that
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<vhqr9n$1b2t7$8@dont-email.me>
User-Agent: slrn/1.0.3 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 28
Message-ID: <rcf0P.211280$pZ%.136218@fx16.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sat, 23 Nov 2024 07:09:11 UTC
Date: Sat, 23 Nov 2024 07:09:11 GMT
X-Received-Bytes: 1884
View all headers

On 2024-11-22, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

> On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote:
>
>> All my programs contain a routine called quit_cleanup(); it takes a
>> single argument, which is either an error message or NULL.
>> It frees all allocated memory, closes any open files, etc.
>
> But all that is unnecessary if your program is terminating anyway.
>
> In *nix C code, a common convention is
>
> if («call failed»)
> {
> perror(«doing what»);
> exit(«nonzero error code»);
> } /*if*/
>
> <https://manpages.debian.org/3/perror.3.en.html>

Perhaps, but I'm a belt-and-suspenders guy - I like
to explicitly free everything come hell or high water.

--
/~\ Charlie Gibbs | Growth for the sake of
\ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
X I'm really at ac.dekanfrus | of the cancer cell.
/ \ if you read it the right way. | -- Edward Abbey

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 07:44 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 07:44:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <vhs153$1k6ft$3@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 08:44:36 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1710589"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eJC+1z13T8dj6qHPJZovj"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:Q5JfXvsluuKqjgGegyEfljLVuPQ=
View all headers

On Sat, 23 Nov 2024 07:09:06 GMT, Charlie Gibbs wrote:

> So it's the good old-fashioned way - free
> each allocation one by one and hope you don't forget one.

One thing that helps is that free(3) is idempotent: calling it on a NULL
pointer is a harmless no-op, so there is no need to check for NULL before
calling it. So my standard technique (simplifying somewhat) is

* Initialize all dynamic storage pointers in this scope to NULL
* Do the various allocations, processing, etc
* Unconditionally free() all dynamic storage pointers in this scope,
allocated or not.

This keeps the code as simple as I can make it.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 07:45 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 07:45:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <vhs16a$1k6ft$4@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<vhqr9n$1b2t7$8@dont-email.me> <rcf0P.211280$pZ%.136218@fx16.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 08:45:15 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1710589"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+oHHF88K1axT7GtJejFtoq"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:DWoubXMxiRcdZJWIMR6h1pDiiuE=
View all headers

On Sat, 23 Nov 2024 07:09:11 GMT, Charlie Gibbs wrote:

> On 2024-11-22, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>
>> On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote:
>>
>>> All my programs contain a routine called quit_cleanup(); it takes a
>>> single argument, which is either an error message or NULL.
>>> It frees all allocated memory, closes any open files, etc.
>>
>> But all that is unnecessary if your program is terminating anyway.
>
> Perhaps, but I'm a belt-and-suspenders guy - I like to explicitly free
> everything come hell or high water.

That actually slows down program termination.

Subject: Re: Joy of this, Joy of that
From: Pancho
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 08:26 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Pancho.Jones@proton.me (Pancho)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 08:26:26 +0000
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <vhs3ji$1kb5c$1@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <vhrbsr$1dqca$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 09:26:27 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0996b149b2c257ae77a172fc1c1f1afd";
logging-data="1715372"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Pc3P3XlUmNTJf5ij/yl3w6j6nOeLh3mo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:tLpOc9QOziLpzCm7Prbhqbw7x0c=
Content-Language: en-GB
In-Reply-To: <vhrbsr$1dqca$2@dont-email.me>
View all headers

On 11/23/24 01:41, Lawrence D'Oliveiro wrote:
> On Sat, 23 Nov 2024 01:08:16 +0000, Pancho wrote:
>
>> On 11/23/24 00:44, Lawrence D'Oliveiro wrote:
>>>
>>> On Fri, 22 Nov 2024 23:07:19 +0000, Pancho wrote:
>>>
>>>> I learnt Smalltalk before I learnt C.
>>>
>>> Smalltalk is an interesting language. But I think it’s considered a
>>> little too unconventional these days ...
>>>
>>> Does it do multiple inheritance? I can’t remember.
>>
>> No, not that I remember. Classes, Metaclasses, Single inheritance, very
>> clean.
>
> “Metaclasses” were just a bit of a hack to implement what Python would
> call “classmethods”.

I think the Smalltalk idea of treating classes as objects, is the
opposite of a hack. It is a very clean and simple idea. Even today I
still think metaclasses are the easiest way to imagine some behaviour of
OO languages.

I would say C++ static methods and static variables are a hack. C# type
reflection is a hack. Just as value types are a hack in C#. Things that
are sensible for performance reasons, but that add complexity.

It was easy to see where Python metaclasses came from.

> Python also has “metaclasses”, in the sense that
> classes, being first-class objects, must be instances of something -- and
> that something is the metaclass.
>
> Not sure if any other language has that meaning for “metaclass”.
>
>> I think Smalltalk was more a teaching tool rather than anything
>> people used commercially
>
> I’m pretty sure it has been used commercially, back in the 1980s or
> so, maybe even the 1990s.

Probably, just as some people program in Haskell or Prolog.

Subject: Re: Joy of this, Joy of that
From: Pancho
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 08:52 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Pancho.Jones@proton.me (Pancho)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 08:52:20 +0000
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <vhs544$1kb5c$2@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <lqcsvtFiao0U1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 09:52:25 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0996b149b2c257ae77a172fc1c1f1afd";
logging-data="1715372"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195+RaVCSimcXaMYhKZOR62HhU1sdkpOzs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:tgCSyCrJa3iQlVqsLcH4PIEDIwg=
Content-Language: en-GB
In-Reply-To: <lqcsvtFiao0U1@mid.individual.net>
View all headers

On 11/23/24 02:29, rbowman wrote:
> On Sat, 23 Nov 2024 01:08:16 +0000, Pancho wrote:
>
>> On 11/23/24 00:44, Lawrence D'Oliveiro wrote:
>>> On Fri, 22 Nov 2024 23:07:19 +0000, Pancho wrote:
>>>
>>>> I learnt Smalltalk before I learnt C.
>>>
>>> Smalltalk is an interesting language. But I think it’s considered a
>>> little too unconventional these days ...
>>>
>>> Does it do multiple inheritance? I can’t remember.
>>
>> No, not that I remember. Classes, Metaclasses, Single inheritance, very
>> clean. I think Smalltalk was more a teaching tool rather than anything
>> people used commercially. It was early enough in my development that OO
>> concepts were like a first language to me. Perhaps if I had had a solid
>> coding background in something like C before being introduced to OO, I
>> would think differently.
>
> A person's experience is definitely a factor. My first language was
> FORTRAN IV although I never did much with it.

FORTRAN 77 was probably the first language I ever read about, but for
some reason it never went further than superficial reading.

> As microcontrollers started
> to appear in industrial applications I mostly worked wiht assembly or C,
> viewing C very much as an abstraction of assembly.
>
> The Boston branch of the IEEE Computer Society was quite active and I
> recall discussions of 'C with Classes' in the early '80s that eventually
> became C++.
>

Did it?, there was Objective C too.

> I think C++ was a premature birth. Stroustrup's first and second editions
> used objects sparingly compared to what many of the popular texts did when
> trying to illustrate inheritance, polymorphism, and so forth.

I'm not sure which version I read, the grey one. It was Ok, not K&R
quality, but still readable.

> The STL and
> Standard Library were years in the future so you had companies like
> Microsoft coming up with MFC.

We used the RougeWave library for container classes.

> Then there was Stroustrup's little quip
> about C++ making it difficult to shoot yourself in the foot but when you
> did you blew your whole leg off.
>
> Esri used C++ for their Arc Objects API so I used C++ but it never became
> my favorite language and the C++ part was mostly manipulating the objects
> rather than overall structure.

I genuinely like OO design. It is the way I naturally think of program
structure. It maps well to designing service orientated architectures.

> I use C# and Python so I don't dislike OO
> when used sparingly. I might even like C++ these days although I have no
> call to use it. When our department moved I looked through my dusty C++
> reference books from 25 years ago and realized they are museum relics.

I haven't used C++ properly for about 25 years.

Subject: Re: Joy of this, Joy of that
From: Pancho
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 09:05 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Pancho.Jones@proton.me (Pancho)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 09:05:55 +0000
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <vhs5tj$1kb5c$3@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 23 Nov 2024 10:05:55 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0996b149b2c257ae77a172fc1c1f1afd";
logging-data="1715372"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185juUnfRKQ/v/NuORkP2v6/FpAvcg2AqM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:t059IUJN54se7BSAcmMqZ16/1XQ=
In-Reply-To: <vhs153$1k6ft$3@dont-email.me>
Content-Language: en-GB
View all headers

On 11/23/24 07:44, Lawrence D'Oliveiro wrote:
> On Sat, 23 Nov 2024 07:09:06 GMT, Charlie Gibbs wrote:
>
>> So it's the good old-fashioned way - free
>> each allocation one by one and hope you don't forget one.
>
> One thing that helps is that free(3) is idempotent:

It isn't idempotent.

> calling it on a NULL
> pointer is a harmless no-op,

OK it is idempotent on NULL, but not in general.

Subject: Re: Joy of this, Joy of that
From: Pancho
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 09:10 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Pancho.Jones@proton.me (Pancho)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 09:10:01 +0000
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <vhs659$1kb5c$4@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<vhqr9n$1b2t7$8@dont-email.me> <rcf0P.211280$pZ%.136218@fx16.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 10:10:02 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0996b149b2c257ae77a172fc1c1f1afd";
logging-data="1715372"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3FC9YLdIFg9kNOkzqpwDL57pEXc3dxWg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:2I8xBEGMT4y+OK00Bb/jxEWUMvE=
Content-Language: en-GB
In-Reply-To: <rcf0P.211280$pZ%.136218@fx16.iad>
View all headers

On 11/23/24 07:09, Charlie Gibbs wrote:
> On 2024-11-22, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>
>> On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote:
>>
>>> All my programs contain a routine called quit_cleanup(); it takes a
>>> single argument, which is either an error message or NULL.
>>> It frees all allocated memory, closes any open files, etc.
>>
>> But all that is unnecessary if your program is terminating anyway.
>>
>> In *nix C code, a common convention is
>>
>> if («call failed»)
>> {
>> perror(«doing what»);
>> exit(«nonzero error code»);
>> } /*if*/
>>
>> <https://manpages.debian.org/3/perror.3.en.html>
>
> Perhaps, but I'm a belt-and-suspenders guy - I like
> to explicitly free everything come hell or high water.
>

I can see that is nice, to understand what you have, but it sounds like
hard work.

However there are some resource you do need to explicitly
free/release/close, some database locks for instance.

Subject: Re: Joy of this, Joy of that
From: Richard Kettlewell
Newsgroups: comp.os.linux.misc
Organization: terraraq NNTP server
Date: Sat, 23 Nov 2024 10:16 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: invalid@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 10:16:46 +0000
Organization: terraraq NNTP server
Message-ID: <wwvjzcu1chd.fsf@LkoBDZeT.terraraq.uk>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="115992"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:l7Ofx5xgfT4uNWayuit7OlE2u+E=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
View all headers

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> On Sat, 23 Nov 2024 07:09:06 GMT, Charlie Gibbs wrote:
>> So it's the good old-fashioned way - free
>> each allocation one by one and hope you don't forget one.
>
> One thing that helps is that free(3) is idempotent:

It is not. Freeing the same non-null pointer twice is a bug (and a
common source of vulnerabilities).

> calling it on a NULL pointer is a harmless no-op, so there is no need
> to check for NULL before calling it. So my standard technique
> (simplifying somewhat) is

‘free() and null out all copies of the pointer that can ever reach
free() in the future’ is idempotent, if you can get it right (which is
usually not too hard in a well-organized program).

--
https://www.greenend.org.uk/rjk/

Subject: Re: Joy of this, Joy of that
From: The Natural Philosop
Newsgroups: comp.os.linux.misc
Organization: A little, after lunch
Date: Sat, 23 Nov 2024 11:16 UTC
References: 1 2 3 4 5 6 7 8
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 11:16:09 +0000
Organization: A little, after lunch
Lines: 41
Message-ID: <vhsdhp$1m6qu$2@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<vhl090$5ghq$1@dont-email.me>
<w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com>
<vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid>
<vhp646$12c7u$1@dont-email.me>
<pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 12:16:10 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d66e216f27af22ed0cfed08003360025";
logging-data="1776478"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kXdsZ9qeYcRU6781eIP8k5kOV4/q/jVo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:63gJaz57wKj75ygy9rZzDJJ4K6s=
In-Reply-To: <pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
Content-Language: en-GB
View all headers

On 23/11/2024 04:57, 186282@ud0s4.net wrote:
> On 11/22/24 12:51 AM, Lawrence D'Oliveiro wrote:
>> On Thu, 21 Nov 2024 20:19:55 -0700, Don_from_AZ wrote:
>>
>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>
>>>> On 21/11/2024 07:20, 186282@ud0s4.net wrote:
>>>>>
>>>>> I take it you're also not a fan of Perl  🙂
>>>>
>>>> Perfectly Execrable Rubbish Language
>>>
>>> I've heard it called:
>>>
>>>    "Pathologically Eclectic Rubbish Lister"
>>
>> It changed the meaning of the term “high-level language” forever.
>
>
>   Well ... glad to see my opinion of Perl is
>   not unique  :-)
>
>   Way back I bought the usual "Learn Perl" book with
>   the camel on the front. About two chapters in I
>   said "WHY ???".
>
I just saw the type of people who created enormous scripts in it, and
thought 'total wankers' They typically read instruction manuals as a
hobby...

If a script gets that big it should be in a different language altogether.

It reminds me of a cartoon picture of a nerd saying 'I use a Unix based
operating system. My computers crash about as often as I get laid'

--
“when things get difficult you just have to lie”

― Jean Claud Jüncker

Subject: Re: Joy of this, Joy of that
From: The Natural Philosop
Newsgroups: comp.os.linux.misc
Organization: A little, after lunch
Date: Sat, 23 Nov 2024 11:20 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 11:20:59 +0000
Organization: A little, after lunch
Lines: 56
Message-ID: <vhsdqr$1m6qu$3@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 12:21:00 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d66e216f27af22ed0cfed08003360025";
logging-data="1776478"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18BdrlGBgOvnGKqRigDh//Rw1t+veKPR9o="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:0nTrzp5ePA4zvUS5TIgSiBOz4gw=
Content-Language: en-GB
In-Reply-To: <mcf0P.211278$pZ%.68099@fx16.iad>
View all headers

On 23/11/2024 07:09, Charlie Gibbs wrote:
> On 2024-11-22, candycanearter07
> <candycanearter07@candycanearter07.nomail.afraid> wrote:
>
>> Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote at 18:53 this Friday (GMT):
>>
>>> On 2024-11-22, The Natural Philosopher <tnp@invalid.invalid> wrote:
>>>
>>>> On 22/11/2024 10:45, Richard Kettlewell wrote:
>>>>
>>>>> The one place I’ll use a goto (in C) is to branch to unified cleanup
>>>>> code in an error case, usually using a macro both to emphasize what’s
>>>>> going on and to stop the error-handling guff from dominating what the
>>>>> reader sees.
>>>>
>>>> +1
>>>> GOTO snafu_nuclear_option... :-)
>>>
>>> All my programs contain a routine called quit_cleanup(); it takes
>>> a single argument, which is either an error message or NULL.
>>> It frees all allocated memory, closes any open files, etc.
>>> (all such variables are global and I initialize them to NULL
>>> or whatever other value is appropriate). Then, if the error
>>> message argument is not NULL, it displays and/or logs the
>>> message and calls exit() with a non-zero argument. If the
>>> error message argument is NULL, it simply calls exit(0).
>>> I can call it from anywhere, and it guarantees an orderly shutdown.
>>
>> Unless you specifically use your own allocation wrapper that adds it to
>> an internal list, how do you deallocate "all" the allocations you've
>> done?
>
> I've occasionally considered making a list, but never got around to
> implementing such a scheme. So it's the good old-fashioned way -
> free each allocation one by one and hope you don't forget one.
> Even then, leaks would be unlikely, because I try to close or free
> resources as soon as I'm done with them, and the de-allocations
> in quit_cleanup() are mostly belt-and-suspenders code.
>
If you never explicitly allocated memory you can, in C, do a longjmp()
back to a stack that implicity frees any local variables.

I dislike the use of malloc and friends in daemons that run forever.
Exiting a program cleans up anyway, Its programs where you are
repeatedly allocating and deallocating memory that give problems. Usual
due to 'unusual' exits that fail to clean up in the normal way.

--
“Puritanism: The haunting fear that someone, somewhere, may be happy.”

H.L. Mencken, A Mencken Chrestomathy

Pages:12345678910111213141516171819202122232425262728293031323334

rocksolid light 0.9.8
clearnet tor