Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A triangle which has an angle of 135 degrees is called an obscene triangle.


devel / comp.lang.c / Re: [OT] UTF-8 sig.

SubjectAuthor
* "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lynn McGuire
+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|`- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"John McCue
|+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Kaz Kylheku
||`- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Tim Rentsch
|`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
| `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Blue-Maned_Hawk
|  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|   +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|   `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Blue-Maned_Hawk
|    `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|     `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Blue-Maned_Hawk
+- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Blue-Maned_Hawk
+- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Michael S
+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|+- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Janis Papanagnou
|+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Kaz Kylheku
||`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| | +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Malcolm McLean
|| | |`- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| | `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |  +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |   `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |    `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |     `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |      `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |       `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |        `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |         `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Janis Papanagnou
||  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
||   `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Janis Papanagnou
||    `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
||`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |+- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |+- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"bart
|| |`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Malcolm McLean
|| | `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Michael S
|| |   `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |    +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |    |`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |    | `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |    `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Michael S
|| |     `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |      `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Michael S
|| |       +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"bart
|| |       |+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Michael S
|| |       ||`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |       || +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Michael S
|| |       || |`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |       || | +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Kaz Kylheku
|| |       || | `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Paavo Helde
|| |       || |  +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |       || |  |+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"bart
|| |       || |  ||`- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |       || |  |`- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Ross Finlayson
|| |       || |  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |       || |   +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |       || |   |`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Kaz Kylheku
|| |       || |   | `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |       || |   |  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Kaz Kylheku
|| |       || |   |   `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |       || |   `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"paavo512
|| |       || |    `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |       || `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Kaz Kylheku
|| |       ||  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |       ||   `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Michael S
|| |       ||    `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David Brown
|| |       ||     +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Michael S
|| |       ||     `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |       ||      `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"aph
|| |       |`- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |       +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"aph
|| |       |`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |       | `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |       |  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Kaz Kylheku
|| |       |   `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|| |       +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
|| |       `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Tim Rentsch
|| `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Kenny McCormack
||  `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|`- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Scott Lurndal
|`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lynn McGuire
| +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lawrence D'Oliveiro
| `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Scott Lurndal
+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Blue-Maned_Hawk
|+- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Chris M. Thomasson
|+* [OT] UTF-8 sig. Was: "White House to Developers: Using C or C++ Invites CyberseBen Bacarisse
||+- Re: [OT] UTF-8 sig. Was: "White House to Developers: Using C or C++ Invites CybScott Lurndal
||`* Re: [OT] UTF-8 sig. Was: "White House to Developers: Using C or C++ Invites CybBlue-Maned_Hawk
|| +* Re: [OT] UTF-8 sig. Was: "White House to Developers: Using C or C++ Invites CybKeith Thompson
|| |`* Re: [OT] UTF-8 sig. Was: "White House to Developers: Using C or C++ Invites CybBlue-Maned_Hawk
|| +* Re: [OT] UTF-8 sig. Was: "White House to Developers: Using C or C++ Invites CybBen
|| `- Re: [OT] UTF-8 sig. Was: "White House to Developers: Using C or C++ Invites Cybyeti
|`- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Lynn McGuire
+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"David LaRue
+* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Derek
`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"Mr. Man-wai Chang

Pages:12345678910
Re: avoiding strdup()

<87il1saaev.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34284&group=comp.lang.c#34284

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Mon, 11 Mar 2024 11:30:32 -0700
Organization: None to speak of
Lines: 26
Message-ID: <87il1saaev.fsf@nosuchdomain.example.com>
References: <us0brl$246bf$1@dont-email.me>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com>
<ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<20240311185039.000066fc@yahoo.com>
<87edcgzo7r.fsf@nosuchdomain.example.com>
<UCHHN.125446$TSTa.5399@fx47.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="803e1d91970c7135fb6b17cffb70db2d";
logging-data="3955985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kjYxy2X/Io2lvbGVWdjRz"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:+jAiF8EzQyuniXv4s1je5Z9x1g4=
sha1:W/EeA8vDaWgg5d8VrCMCyFTMcXs=
 by: Keith Thompson - Mon, 11 Mar 2024 18:30 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>Michael S <already5chosen@yahoo.com> writes:
>>[...]
>>> Is there any chance at all that on typical Linux machine (i.e. the one
>>> configured to overcommit virtual memory) strdup() returns NULL?
>>> If it was malloc() I'd say - no chance. For strdup() I'm less sure.
>>
>>strdup() calls malloc(), so strdup() can return NULL if and only if
>>malloc() can return NULL -- but with the additional constraint that you
>>first need to have a string argument to strdup() that's long enough to
>>cause a suffiently large argument to be passed to malloc().
>>
>>One data point: On my Ubuntu system, malloc(SIZE_MAX) returns NULL for
>>very large arguments (over about 23 GiB in my quick and dirty test).
>
> That may be due to resource limits (setrlimit/getrlimit/ulimit) on
> the size of the address space.

I don't see anything relevant in the output of `ulimit -a`. In
particular, "data seg size" is unlimited.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: avoiding strdup()

<wwv7ci837oa.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34285&group=comp.lang.c#34285

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: inva...@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Mon, 11 Mar 2024 19:11:33 +0000
Organization: terraraq NNTP server
Message-ID: <wwv7ci837oa.fsf@LkoBDZeT.terraraq.uk>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com>
<ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<yMGHN.481214$PuZ9.381006@fx11.iad> <20240311104527.444@kylheku.com>
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="19315"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:StlCtbDup8xr2MCgIhJ6/Zj/wTQ=
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
 by: Richard Kettlewell - Mon, 11 Mar 2024 19:11 UTC

Kaz Kylheku <433-929-6894@kylheku.com> writes:
> Scott Lurndal <scott@slp53.sl.home> wrote:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>On 10/03/2024 18:47, Scott Lurndal wrote:
>>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>>> Not take up space in every application for a common library routine.
>>>>
>>>> It's a form of lazy programming. I've seen a lot of open source
>>>> code that uses strdup without checking for failure and frequently
>>>> "forgetting" to free the result.
>>>
>>>And it is probably more likely that machine with many gigabytes of RAM
>>
>> Actually, your assumptions that:
>> 1) strdup is the only allocation function used by an application
>> 2) all strings are "short"
>
> Even if a string is long enough to need its own mmap request,
> that will still return valid memory that later fails to commit.

Since strdup necessarily writes to almost all the memory it allocates,
you’d expect the failure to be immediate.

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

Re: avoiding strdup()

<875xxsa7gk.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34286&group=comp.lang.c#34286

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Mon, 11 Mar 2024 12:34:19 -0700
Organization: None to speak of
Lines: 33
Message-ID: <875xxsa7gk.fsf@nosuchdomain.example.com>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com>
<ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<yMGHN.481214$PuZ9.381006@fx11.iad> <20240311104527.444@kylheku.com>
<wwv7ci837oa.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="803e1d91970c7135fb6b17cffb70db2d";
logging-data="3990758"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/gEWXayEIu94bX63j/vF99"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:HcmiD9PG0aL9VV/fjiHWlFsmFyI=
sha1:lq1Mxjc/OpjQychjc0kuA4/1Ugw=
 by: Keith Thompson - Mon, 11 Mar 2024 19:34 UTC

Richard Kettlewell <invalid@invalid.invalid> writes:
> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>> Scott Lurndal <scott@slp53.sl.home> wrote:
>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>>On 10/03/2024 18:47, Scott Lurndal wrote:
>>>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>>>> Not take up space in every application for a common library routine.
>>>>>
>>>>> It's a form of lazy programming. I've seen a lot of open source
>>>>> code that uses strdup without checking for failure and frequently
>>>>> "forgetting" to free the result.
>>>>
>>>>And it is probably more likely that machine with many gigabytes of RAM
>>>
>>> Actually, your assumptions that:
>>> 1) strdup is the only allocation function used by an application
>>> 2) all strings are "short"
>>
>> Even if a string is long enough to need its own mmap request,
>> that will still return valid memory that later fails to commit.
>
> Since strdup necessarily writes to almost all the memory it allocates,
> you’d expect the failure to be immediate.

Yes, but that write happens *after* the malloc() call, so it won't
necessarily be reflected in the value returned by strdup(). It could
crash the current program, or in the worst case it could cause the OoM
killer to kill some other process.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: avoiding strdup()

<caIp5UwudOJvMTdVb@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34287&group=comp.lang.c#34287

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Mon, 11 Mar 2024 19:45:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <caIp5UwudOJvMTdVb@bongo-ra.co>
References: <us0brl$246bf$1@dont-email.me> <pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid> <87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid> <usc845$10v6e$1@dont-email.me> <pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me> <87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com> <ifnHN.386274$vFZa.250421@fx13.iad>
<usnb64$3n297$1@dont-email.me> <20240311185039.000066fc@yahoo.com> <87edcgzo7r.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Mar 2024 19:45:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5b7f4a9274de11a35a2cde98e30111a7";
logging-data="3995233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19abiUz0H2OmuvMC/gGoV4/"
Cancel-Lock: sha1:5mpfTYux2UXzu5Ylk/rYQ4JCIA8=
X-Server-Commands: nowebcancel
In-Reply-To: <87edcgzo7r.fsf@nosuchdomain.example.com>
X-Organisation: Weyland-Yutani
 by: Spiros Bousbouras - Mon, 11 Mar 2024 19:45 UTC

On Mon, 11 Mar 2024 10:13:12 -0700
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> One data point: On my Ubuntu system, malloc(SIZE_MAX) returns NULL for
> very large arguments (over about 23 GiB in my quick and dirty test).

You lost me there.

Re: avoiding strdup()

<YkhvH0ibt4fqZu1NS@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34288&group=comp.lang.c#34288

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!paganini.bofh.team!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Mon, 11 Mar 2024 19:57:22 -0000 (UTC)
Organization: To protect and to server
Message-ID: <YkhvH0ibt4fqZu1NS@bongo-ra.co>
References: <us0brl$246bf$1@dont-email.me> <87y1ayj6hs.fsf_-_@bsb.me.uk> <pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me> <pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid> <ushea7$28prq$2@dont-email.me>
<ushnkb$1rnlb$4@dont-email.me> <87r0gizzuo.fsf@nosuchdomain.example.com> <20240310101101.00001fd4@yahoo.com>
<20240310100715.866@kylheku.com> <ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<20240311185039.000066fc@yahoo.com> <ERGHN.481215$PuZ9.417692@fx11.iad> <20240311193511.0000610f@yahoo.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Mar 2024 19:57:22 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="3429499"; posting-host="9H7U5kayiTdk7VIdYU44Rw.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
Cancel-Lock: sha256:ZNq4ymiYlHvLug0TKuqFHYXqznL4MoiaK+mNgDOYjUo=
X-Notice: Filtered by postfilter v. 0.9.3
X-Server-Commands: nowebcancel
X-Organisation: Weyland-Yutani
 by: Spiros Bousbouras - Mon, 11 Mar 2024 19:57 UTC

On Mon, 11 Mar 2024 19:35:11 +0200
Michael S <already5chosen@yahoo.com> wrote:
> Some people would say that writing code (a handler for allocation
> returning NULL) that either can't be tested in principle or can be
> tested only in principle, but most certainly not tested in
> practice, isn't a sign of a good programmer.

It can be tested in practice by explicitly inserting failure code , perhaps
activated by a macro :

pointer = malloc(...) ;
if (pointer == 0 || testN) { ... handle error ... } ;

It clutters the code but it's testable.

> Myself, I still tend to code this checks, but
> (1) my main targets are not Linux with overcommit, so the
> chance of allocation returning NULL could be estimated like "not going
> to happen" rather than "can't happen".
> (2) I am old full that like his unreasonable old habits

What's the practical difference between "not going to happen" and
"can't happen" ? Practically , you can never know that it can't happen
because overcommit is a matter of configuration of the Linux system.

Re: avoiding strdup()

<871q8ga5rd.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34289&group=comp.lang.c#34289

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.samoylyk.net!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Mon, 11 Mar 2024 13:11:02 -0700
Organization: None to speak of
Lines: 20
Message-ID: <871q8ga5rd.fsf@nosuchdomain.example.com>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com>
<ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<20240311185039.000066fc@yahoo.com>
<87edcgzo7r.fsf@nosuchdomain.example.com>
<caIp5UwudOJvMTdVb@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="803e1d91970c7135fb6b17cffb70db2d";
logging-data="4005227"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191469dh/28tV3I7G/DHRX+"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:6zOlpdj/Kl6npA4zN1+8Lfo+xEU=
sha1:bxvBQyG5m9tK41JG+CjZzab4l+o=
 by: Keith Thompson - Mon, 11 Mar 2024 20:11 UTC

Spiros Bousbouras <spibou@gmail.com> writes:
> On Mon, 11 Mar 2024 10:13:12 -0700
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> One data point: On my Ubuntu system, malloc(SIZE_MAX) returns NULL for
>> very large arguments (over about 23 GiB in my quick and dirty test).
>
> You lost me there.

Sorry, editing error. I initially tried malloc(SIZE_MAX) and got a NULL
result. I then tried smaller values to try to find out where the cutoff
is, and didn't correctly edit the post.

Corrected version:
One data point: On my Ubuntu system, malloc() returns NULL for
very large arguments (over about 23 GiB in my quick and dirty test).

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

<uso64i$3t3jn$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34290&group=comp.lang.c#34290

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: "White House to Developers: Using C or C++ Invites Cybersecurity
Risks"
Date: Tue, 12 Mar 2024 00:03:31 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uso64i$3t3jn$1@dont-email.me>
References: <us0brl$246bf$1@dont-email.me>
<XnsB12AC133C49E3hueydlltampabayrrcom@135.181.20.170>
<us33a0$2ot8t$1@dont-email.me> <us3n2c$306pr$1@dont-email.me>
<us6ckb$3khma$2@dont-email.me> <us6ge5$3l59s$4@dont-email.me>
<us6s1l$3nb7r$2@dont-email.me> <us8180$3v3cu$1@dont-email.me>
<20240305132240.241@kylheku.com> <87plw8pci5.fsf@nosuchdomain.example.com>
<us84q3$3vqtf$1@dont-email.me> <us9rdq$eiqh$2@dont-email.me>
<usdjec$1a50p$6@dont-email.me> <usegkh$1ivtt$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 12 Mar 2024 00:03:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11b38f0fdef8c619d895dc1d0c253c52";
logging-data="4099703"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zpjOMYg5nDVoboRFDUh+z"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:VYyVocpEtKmv+1pGcCMvMGa939g=
 by: Lawrence D'Oliv - Tue, 12 Mar 2024 00:03 UTC

On Fri, 8 Mar 2024 09:01:21 +0100, David Brown wrote:

> It seems much more appropriate for Ada (though Pascal also had stricter
> checking and stronger types than most other popular languages had when
> Pascal was developed).

That’s why Ada was built on Pascal: if you want something intended for
high-reliability, safety-critical applications, why not build it on a
foundation that was already the most, shall we say, anal-retentive, among
well-known languages of the time?

Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

<uso6br$3t3jn$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34291&group=comp.lang.c#34291

  copy link   Newsgroups: comp.lang.c comp.lang.c++ comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.java.programmer
Subject: Re: "White House to Developers: Using C or C++ Invites Cybersecurity
Risks"
Date: Tue, 12 Mar 2024 00:07:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uso6br$3t3jn$2@dont-email.me>
References: <us0brl$246bf$1@dont-email.me>
<XnsB12AC133C49E3hueydlltampabayrrcom@135.181.20.170>
<us33a0$2ot8t$1@dont-email.me> <us3n2c$306pr$1@dont-email.me>
<us6ckb$3khma$2@dont-email.me> <us6ge5$3l59s$4@dont-email.me>
<us6s1l$3nb7r$2@dont-email.me> <us8180$3v3cu$1@dont-email.me>
<20240305132240.241@kylheku.com> <us83nu$3vinv$1@dont-email.me>
<87le6wpbvc.fsf@nosuchdomain.example.com> <us86kr$7j8$1@dont-email.me>
<us9r86$eiqh$1@dont-email.me> <us9sao$erpl$1@dont-email.me>
<20240306161842.00001400@yahoo.com> <usafb2$irvm$1@dont-email.me>
<20240306114939.761@kylheku.com> <usaipk$jjq3$1@dont-email.me>
<ha2dnVzbM9-naHb4nZ2dnZfqnPWdnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 12 Mar 2024 00:07:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11b38f0fdef8c619d895dc1d0c253c52";
logging-data="4099703"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+NhE5D4/rQklBC+3gKBFbT"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:0ljCkFcD0ORvlxRxw3woam6SUx8=
 by: Lawrence D'Oliv - Tue, 12 Mar 2024 00:07 UTC

On Fri, 8 Mar 2024 21:36:14 -0800, Ross Finlayson wrote:

> What I'd like to know about is who keeps dialing the "harmonization"
> efforts, which really must give grouse to the "harmonisation"
> spellers ...

Some words came from French and had “-ize”, others did not and had “-ise”.
Some folks in Britain decided to change the former to the latter.

“Televise”, “merchandise”, “advertise” -- never any “-ize” form.

“Synchronize”, “harmonize”, “apologize” -- “-ize” originally.

Re: avoiding strdup()

<usoa6a$3tqji$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34293&group=comp.lang.c#34293

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Tue, 12 Mar 2024 01:12:42 +0000
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <usoa6a$3tqji$1@dont-email.me>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com> <20240310101101.00001fd4@yahoo.com>
<20240310100715.866@kylheku.com> <ifnHN.386274$vFZa.250421@fx13.iad>
<usnb64$3n297$1@dont-email.me> <yMGHN.481214$PuZ9.381006@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Mar 2024 01:12:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ed016f3d6de4e923139e945dbcc26ebc";
logging-data="4123250"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18H6zoowCszxwGEd9KfuJOi1SB8HdsznCI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:y1YmgejcnFE25Xo2fXuydtg+M94=
Content-Language: en-GB
In-Reply-To: <yMGHN.481214$PuZ9.381006@fx11.iad>
 by: Malcolm McLean - Tue, 12 Mar 2024 01:12 UTC

On 11/03/2024 17:00, Scott Lurndal wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>> On 10/03/2024 18:47, Scott Lurndal wrote:
>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>> On 2024-03-10, Michael S <already5chosen@yahoo.com> wrote:
>>>>> On Sat, 09 Mar 2024 16:37:19 -0800
>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>>> strdup() and strndup() are being added to the C23 standard.
>>>>>>
>>>>>
>>>>> What is justification?
>>>>
>>>> strdup is required by POSIX already and thus widely implemented.
>>>> Many programmers who are not into standards already assume it's in C.
>>>>
>>>> For decades, portable programs have been doing things like this:
>>>>
>>>> #if HAVE_STRDUP
>>>> #define xstrdup(s) strdup(s)
>>>> #else
>>>> char *xstrdup(const char *); // own definition
>>>> #endif
>>>>
>>>>> What strdup() can do better, for any chosen value of better, than
>>>>> strlen()+malloc()+memcpy() ?
>>>>
>>>> Not take up space in every application for a common library routine.
>>>
>>> It's a form of lazy programming. I've seen a lot of open source
>>> code that uses strdup without checking for failure and frequently
>>> "forgetting" to free the result.
>>
>> And it is probably more likely that machine with many gigabytes of RAM
>
> Actually, your assumptions that:
> 1) strdup is the only allocation function used by an application
> 2) all strings are "short"
>
> are both flawed.
>
The bank has many billions. But there is a banking crisis on and it is
about to fail. And someone, somewhere, will be that man who tries to
withdraw some money and is told "no". But how likely is that man to be
you with your 20 pounds at the cashpoint? How likely is it to be another
bank making a cash call for a 100 million or so?

And how often do banks fail, actually, and how often does government
take action when it's heading that way, but nowhere near failing yet?

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: avoiding strdup()

<87sf0w8cux.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34295&group=comp.lang.c#34295

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Mon, 11 Mar 2024 18:20:38 -0700
Organization: None to speak of
Lines: 62
Message-ID: <87sf0w8cux.fsf@nosuchdomain.example.com>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com>
<ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<yMGHN.481214$PuZ9.381006@fx11.iad> <usoa6a$3tqji$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="de8f53c78bf32f77c14d770a36ea4d62";
logging-data="4123696"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/e9Xosb3pavG9kjrfd5hq6"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:Is7eHEN/1qcWu4FwpOyjAz0PEG4=
sha1:WoNuGlm17tLSWSJd8Hnh+2KRLhA=
 by: Keith Thompson - Tue, 12 Mar 2024 01:20 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> On 11/03/2024 17:00, Scott Lurndal wrote:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>> On 10/03/2024 18:47, Scott Lurndal wrote:
>>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>>> On 2024-03-10, Michael S <already5chosen@yahoo.com> wrote:
>>>>>> On Sat, 09 Mar 2024 16:37:19 -0800
>>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>>>> strdup() and strndup() are being added to the C23 standard.
>>>>>>>
>>>>>>
>>>>>> What is justification?
>>>>>
>>>>> strdup is required by POSIX already and thus widely implemented.
>>>>> Many programmers who are not into standards already assume it's in C.
>>>>>
>>>>> For decades, portable programs have been doing things like this:
>>>>>
>>>>> #if HAVE_STRDUP
>>>>> #define xstrdup(s) strdup(s)
>>>>> #else
>>>>> char *xstrdup(const char *); // own definition
>>>>> #endif
>>>>>
>>>>>> What strdup() can do better, for any chosen value of better, than
>>>>>> strlen()+malloc()+memcpy() ?
>>>>>
>>>>> Not take up space in every application for a common library routine.
>>>>
>>>> It's a form of lazy programming. I've seen a lot of open source
>>>> code that uses strdup without checking for failure and frequently
>>>> "forgetting" to free the result.
>>>
>>> And it is probably more likely that machine with many gigabytes of RAM
>> Actually, your assumptions that:
>> 1) strdup is the only allocation function used by an application
>> 2) all strings are "short"
>> are both flawed.
>>
> The bank has many billions. But there is a banking crisis on and it is
> about to fail. And someone, somewhere, will be that man who tries to
> withdraw some money and is told "no". But how likely is that man to be
> you with your 20 pounds at the cashpoint? How likely is it to be
> another bank making a cash call for a 100 million or so?

If I withdraw 20 pounds from my bank, I'll bet you that 20 pounds that
the bank still checks whether it has the money.

I'd rather write correct code than code that almost certainly happens to
work. Sure, strdup() is unlikely to fail-- but I'm going to check the
result.

> And how often do banks fail, actually, and how often does government
> take action when it's heading that way, but nowhere near failing yet?

The government isn't going to intervene when your laptop is running low
on memory.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

<SD6dnWlgV-b2W3L4nZ2dnZfqnPhi4p2d@giganews.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34298&group=comp.lang.c#34298

  copy link   Newsgroups: comp.lang.c comp.lang.c++ comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!69.80.99.26.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 12 Mar 2024 03:05:15 +0000
Subject: Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"
Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.java.programmer
References: <us0brl$246bf$1@dont-email.me> <XnsB12AC133C49E3hueydlltampabayrrcom@135.181.20.170> <us33a0$2ot8t$1@dont-email.me> <us3n2c$306pr$1@dont-email.me> <us6ckb$3khma$2@dont-email.me> <us6ge5$3l59s$4@dont-email.me> <us6s1l$3nb7r$2@dont-email.me> <us8180$3v3cu$1@dont-email.me> <20240305132240.241@kylheku.com> <us83nu$3vinv$1@dont-email.me> <87le6wpbvc.fsf@nosuchdomain.example.com> <us86kr$7j8$1@dont-email.me> <us9r86$eiqh$1@dont-email.me> <us9sao$erpl$1@dont-email.me> <20240306161842.00001400@yahoo.com> <usafb2$irvm$1@dont-email.me> <20240306114939.761@kylheku.com> <usaipk$jjq3$1@dont-email.me> <ha2dnVzbM9-naHb4nZ2dnZfqnPWdnZ2d@giganews.com> <uso6br$3t3jn$2@dont-email.me>
From: ross.a.f...@gmail.com (Ross Finlayson)
Date: Mon, 11 Mar 2024 20:05:19 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <uso6br$3t3jn$2@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Message-ID: <SD6dnWlgV-b2W3L4nZ2dnZfqnPhi4p2d@giganews.com>
Lines: 115
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-9PdtUN+kylfnYtj86R9lsWfuZPtQCk942+kMX6IENKO8d5WZ3qhEq0ED/fAM4+Q//r7NUXdqkHBfCMF!KIp4wqTVeDkgxJ7AJFiswaNACeQNqhH5CJtWeGXXCC1T85SIWx4w1tNMF+ivGRFVg5h38rE8a4yJ
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
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
 by: Ross Finlayson - Tue, 12 Mar 2024 03:05 UTC

On 03/11/2024 05:07 PM, Lawrence D'Oliveiro wrote:
> On Fri, 8 Mar 2024 21:36:14 -0800, Ross Finlayson wrote:
>
>> What I'd like to know about is who keeps dialing the "harmonization"
>> efforts, which really must give grouse to the "harmonisation"
>> spellers ...
>
> Some words came from French and had “-ize”, others did not and had “-ise”.
> Some folks in Britain decided to change the former to the latter.
>
> “Televise”, “merchandise”, “advertise” -- never any “-ize” form.
>
> “Synchronize”, “harmonize”, “apologize” -- “-ize” originally.
>

Hey thanks that's something I hadn't thought,
that the harmonization was coming from this
side of the pond besides vice-versa, with regards
to that "harmonization" is an effort in controlled
languages in terms of natural languages which
are organic though of course subject their extended
memory the written corpi, which I write corpi, not corpora.

It's like when the dictionary adds new words,
the old words are still words, in, the "Wortbuch",
an abstract dictionary of all the words, that I read
about in Curme. (I'm a fan of Tesniere and Curme.)

About parsing and re-writing systems, I'm really wondering
a lot about, compilation units, lines, spacing and indentation,
blocks, comments, quoting, punctuation, identifiers,
brackets, commas, and stops, how to write grammars
for all sorts usual source language in those, and result,
a novel sort of linear data structure above those,
in whatever languages so recognized in those,
and any sections it doesn't as the source text.

I looked around a bit and after re-writing on the Wiki
and "multi-pass parser" there are some sorts ideas,
usually in terms of fungible intermediate languages
for targeting those to whatever languages, here
though mostly to deal with a gamut of existing code,
there are lots of syntax recognizers and highlighters
and this kind of thing, "auto-detect" in the static
analysis toolkit, the languages, then as with regards to
that a given compilation unit is only gonna be one or
a few languages in it, with regards for example to
"code in text" or "text in code", about comments,
sections, blocks, or "language integrated code"
or "convenience code", "sugar modes", you know,
about what the _grammar_ specifications would be,
and the lexical and syntax the specifications, to
arrive at a multi-pass parser, that compiles a whole
bunch of language specs, finds which ones apply
where to the compilation unit, then starts building
them up "lifting" them above the character sequence,
building an "abstract syntax sequence" (yeah I know)
above that, then building a model of the productions
directly above that, that happens to be exactly derived
from the grammar productions, with the same sort
of structure as the grammar productions.

(Order, loop, optional, a superset of eBNF, to support
syntaxes with bracket blocks like C-style and syntaxes
with indent blocks though I'm not into that, the various
inversions of comments and code, the various interpolations
of quoting, brackets and grouping and precedence,
commas and joining and separating, and because SQL
doesn't really comport itself to BNF, these kinds of things.)

Of course it's obligatory that this would be about C/C++
and as with regards to Java which of course is in the
same style, or that its derivative, is for example that
M4/C/C++ code is already to a multi-pass parser, and,
Java at some point added language features which
fundamentally require a multi-pass parser, so it's not
like the entire resources of the mainframe has to fit
a finite-state-machine on the read-head, in fact at
compile-time specifically there's "it's fair to consider
a concatenation of the compilation units as a linear
input in space", then figuring the "liftings" are linear
in that, in space, then that the productions whence
derived are as concise as the productions a minimal
model, thus discardable the intermediate bit, is for
introducing a sort of common model of language
representation, source language, for reference
implementations of the grammars, then to make
the act of ingestion of sources in languages as a
first-class kind of thing, I'm looking for one of those,
and that's about as much I've figured out it is.

It's such a usual idea I must imagine that it's
commonplace, as it's just the very most simple
act of the model of iterating these things and
reading them out.

I probably might not care about it but getting
to where it takes a parser that can parse SQL
for example, or, you know, when there are lots
of source formats but it's just data and definitions,
yeah if you know that there's like a very active
open project in that I'd be real interested in a
sort of "source/object/relational mapping", ...,
as it were, "source/grammatical-production mapping",
what results you identify grammars and pick sources
and it prints out the things.

I'm familiar with the traditional approaches,
and intend to employ them. I figure this
must be a very traditional approach if
nobody's heard of it.

Re: avoiding strdup()

<uspt19$c2he$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34310&group=comp.lang.c#34310

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Tue, 12 Mar 2024 15:40:25 +0000
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <uspt19$c2he$1@dont-email.me>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com> <20240310101101.00001fd4@yahoo.com>
<20240310100715.866@kylheku.com> <ifnHN.386274$vFZa.250421@fx13.iad>
<usnb64$3n297$1@dont-email.me> <yMGHN.481214$PuZ9.381006@fx11.iad>
<usoa6a$3tqji$1@dont-email.me> <87sf0w8cux.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Mar 2024 15:40:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ed016f3d6de4e923139e945dbcc26ebc";
logging-data="395822"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/M8JiHnaTAUlD0nBrwQaY5xp17/w7VGS0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:IwuNT4GSOJHe+taJE/uOk0VWjkI=
Content-Language: en-GB
In-Reply-To: <87sf0w8cux.fsf@nosuchdomain.example.com>
 by: Malcolm McLean - Tue, 12 Mar 2024 15:40 UTC

On 12/03/2024 01:20, Keith Thompson wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>> On 11/03/2024 17:00, Scott Lurndal wrote:
>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>> On 10/03/2024 18:47, Scott Lurndal wrote:
>>>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>>>> On 2024-03-10, Michael S <already5chosen@yahoo.com> wrote:
>>>>>>> On Sat, 09 Mar 2024 16:37:19 -0800
>>>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>>>>> strdup() and strndup() are being added to the C23 standard.
>>>>>>>>
>>>>>>>
>>>>>>> What is justification?
>>>>>>
>>>>>> strdup is required by POSIX already and thus widely implemented.
>>>>>> Many programmers who are not into standards already assume it's in C.
>>>>>>
>>>>>> For decades, portable programs have been doing things like this:
>>>>>>
>>>>>> #if HAVE_STRDUP
>>>>>> #define xstrdup(s) strdup(s)
>>>>>> #else
>>>>>> char *xstrdup(const char *); // own definition
>>>>>> #endif
>>>>>>
>>>>>>> What strdup() can do better, for any chosen value of better, than
>>>>>>> strlen()+malloc()+memcpy() ?
>>>>>>
>>>>>> Not take up space in every application for a common library routine.
>>>>>
>>>>> It's a form of lazy programming. I've seen a lot of open source
>>>>> code that uses strdup without checking for failure and frequently
>>>>> "forgetting" to free the result.
>>>>
>>>> And it is probably more likely that machine with many gigabytes of RAM
>>> Actually, your assumptions that:
>>> 1) strdup is the only allocation function used by an application
>>> 2) all strings are "short"
>>> are both flawed.
>>>
>> The bank has many billions. But there is a banking crisis on and it is
>> about to fail. And someone, somewhere, will be that man who tries to
>> withdraw some money and is told "no". But how likely is that man to be
>> you with your 20 pounds at the cashpoint? How likely is it to be
>> another bank making a cash call for a 100 million or so?
>
> If I withdraw 20 pounds from my bank, I'll bet you that 20 pounds that
> the bank still checks whether it has the money.
>
> I'd rather write correct code than code that almost certainly happens to
> work. Sure, strdup() is unlikely to fail-- but I'm going to check the
> result.
>
>> And how often do banks fail, actually, and how often does government
>> take action when it's heading that way, but nowhere near failing yet?
>
> The government isn't going to intervene when your laptop is running low
> on memory.
>
No, it's an analogy. You run lots of apps gobbling lots of memory, and
maybe a program won't launch or thngs start to slow or a warning comes
up, and you realise that soon the program of interest might run out of
memory, and so you shut other things down so that that doesn't happen.
And so it's pretty rare to actually run out of memory unless the program
isn't correct and there is a leak.

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: avoiding strdup()

<ZV_HN.561554$xHn7.260048@fx14.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34313&group=comp.lang.c#34313

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: avoiding strdup()
Newsgroups: comp.lang.c
References: <us0brl$246bf$1@dont-email.me> <usc845$10v6e$1@dont-email.me> <pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid> <ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me> <87r0gizzuo.fsf@nosuchdomain.example.com> <20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com> <ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me> <yMGHN.481214$PuZ9.381006@fx11.iad> <usoa6a$3tqji$1@dont-email.me> <87sf0w8cux.fsf@nosuchdomain.example.com>
Lines: 56
Message-ID: <ZV_HN.561554$xHn7.260048@fx14.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 12 Mar 2024 15:55:37 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 12 Mar 2024 15:55:37 GMT
X-Received-Bytes: 3413
 by: Scott Lurndal - Tue, 12 Mar 2024 15:55 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>> On 11/03/2024 17:00, Scott Lurndal wrote:
>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>> On 10/03/2024 18:47, Scott Lurndal wrote:
>>>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>>>> On 2024-03-10, Michael S <already5chosen@yahoo.com> wrote:
>>>>>>> On Sat, 09 Mar 2024 16:37:19 -0800
>>>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>>>>> strdup() and strndup() are being added to the C23 standard.
>>>>>>>>
>>>>>>>
>>>>>>> What is justification?
>>>>>>
>>>>>> strdup is required by POSIX already and thus widely implemented.
>>>>>> Many programmers who are not into standards already assume it's in C.
>>>>>>
>>>>>> For decades, portable programs have been doing things like this:
>>>>>>
>>>>>> #if HAVE_STRDUP
>>>>>> #define xstrdup(s) strdup(s)
>>>>>> #else
>>>>>> char *xstrdup(const char *); // own definition
>>>>>> #endif
>>>>>>
>>>>>>> What strdup() can do better, for any chosen value of better, than
>>>>>>> strlen()+malloc()+memcpy() ?
>>>>>>
>>>>>> Not take up space in every application for a common library routine.
>>>>>
>>>>> It's a form of lazy programming. I've seen a lot of open source
>>>>> code that uses strdup without checking for failure and frequently
>>>>> "forgetting" to free the result.
>>>>
>>>> And it is probably more likely that machine with many gigabytes of RAM
>>> Actually, your assumptions that:
>>> 1) strdup is the only allocation function used by an application
>>> 2) all strings are "short"
>>> are both flawed.
>>>
>> The bank has many billions. But there is a banking crisis on and it is
>> about to fail. And someone, somewhere, will be that man who tries to
>> withdraw some money and is told "no". But how likely is that man to be
>> you with your 20 pounds at the cashpoint? How likely is it to be
>> another bank making a cash call for a 100 million or so?
>
>If I withdraw 20 pounds from my bank, I'll bet you that 20 pounds that
>the bank still checks whether it has the money.

And as for "how likely it is that the bank will not be able
to honor withdrawal requests", I refer Malcolm to 1931.

"In 1930, 1,352 banks held more than $853 million in
deposits; in 1931, one year later, 2,294 banks failed
with nearly $1.7 billion in deposits."

Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

<d05dfd7d-a2fd-49da-a2de-1ce0ad0026b3@gmail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34316&group=comp.lang.c#34316

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: thiago.a...@gmail.com (Thiago Adams)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: "White House to Developers: Using C or C++ Invites Cybersecurity
Risks"
Date: Tue, 12 Mar 2024 15:54:21 -0300
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <d05dfd7d-a2fd-49da-a2de-1ce0ad0026b3@gmail.com>
References: <us0brl$246bf$1@dont-email.me>
<us780t$3pku4$1@toylet.eternal-september.org>
<us96rh$962c$1@toylet.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="713f1c401e6d48d953031393ec49325f";
logging-data="483642"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2+vXfvG6N1YT7FKwUO2tSQ34TI3U86TY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:R4M5wxKaiLuHJOAD/BShIu3m0zk=
In-Reply-To: <us96rh$962c$1@toylet.eternal-september.org>
Content-Language: en-US
 by: Thiago Adams - Tue, 12 Mar 2024 18:54 UTC

On 06/03/2024 04:43, Mr. Man-wai Chang wrote:
> On 5/3/2024 9:51 pm, Mr. Man-wai Chang wrote:
>> On 3/3/2024 7:13 am, Lynn McGuire wrote:
>>>
>>> "The Biden administration backs a switch to more memory-safe programming
>>> languages. The tech industry sees their point, but it won't be easy."
>>>
>>> No.  The feddies want to regulate software development very much.  They
>>> have been talking about it for at least 20 years now.  This is a very
>>> bad thing.
>>
>> A responsible, good progreammer or a better C/C++ pre-processor can
>> avoid a lot of problems!!
>
> Or maybe A.I.-assisted code analyzer?? But there are still blind spots...

I think AI could be used and give goods result but it is not ideal.
The advantage of AI it could understand patterns. Like the names init
and destroy could work as tips or patterns.

However, I think programming needs a formal language for contracts and
the static analysis needs to check them.
Also ideally is better contracts for the interface rather having to see
the body of the functions.

Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

<e2773a5e-75ea-4acd-886b-c4bee21f9955@gmail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34317&group=comp.lang.c#34317

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: thiago.a...@gmail.com (Thiago Adams)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: "White House to Developers: Using C or C++ Invites Cybersecurity
Risks"
Date: Tue, 12 Mar 2024 16:00:31 -0300
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <e2773a5e-75ea-4acd-886b-c4bee21f9955@gmail.com>
References: <us0brl$246bf$1@dont-email.me>
<us780t$3pku4$1@toylet.eternal-september.org>
<us96rh$962c$1@toylet.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="713f1c401e6d48d953031393ec49325f";
logging-data="483642"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GmhIMs0TAyYhr/pphOrTPPFslLsLbr5M="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:5jB+QbFatAA5dXurfDPATzDVahk=
In-Reply-To: <us96rh$962c$1@toylet.eternal-september.org>
Content-Language: en-US
 by: Thiago Adams - Tue, 12 Mar 2024 19:00 UTC

On 06/03/2024 04:43, Mr. Man-wai Chang wrote:
> On 5/3/2024 9:51 pm, Mr. Man-wai Chang wrote:
>> On 3/3/2024 7:13 am, Lynn McGuire wrote:
>>>
>>> "The Biden administration backs a switch to more memory-safe programming
>>> languages. The tech industry sees their point, but it won't be easy."
>>>
>>> No.  The feddies want to regulate software development very much.  They
>>> have been talking about it for at least 20 years now.  This is a very
>>> bad thing.
>>
>> A responsible, good progreammer or a better C/C++ pre-processor can
>> avoid a lot of problems!!
>
> Or maybe A.I.-assisted code analyzer?? But there are still blind spots...

I think AI could be used and give goods result but it is not ideal.
The advantage of AI it could understand patterns. Like the names init
and destroy could work as tips or patterns.

However, I think programming needs a formal language for contracts and
the static analysis needs to check them.
Also ideally is better contracts for the interface rather having to see
the body of the functions.

Re: avoiding strdup()

<87cyrz84l0.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34322&group=comp.lang.c#34322

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Tue, 12 Mar 2024 15:31:39 -0700
Organization: None to speak of
Lines: 33
Message-ID: <87cyrz84l0.fsf@nosuchdomain.example.com>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com>
<ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<yMGHN.481214$PuZ9.381006@fx11.iad> <usoa6a$3tqji$1@dont-email.me>
<87sf0w8cux.fsf@nosuchdomain.example.com>
<uspt19$c2he$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="de8f53c78bf32f77c14d770a36ea4d62";
logging-data="574840"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19eOZidY1WRhgDdopEZATuq"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:ymVuZS3FFhgU8xwwvVP+8SlKRww=
sha1:hr2ZpGWlcTUJZ3qbGcreiHTXEfE=
 by: Keith Thompson - Tue, 12 Mar 2024 22:31 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> On 12/03/2024 01:20, Keith Thompson wrote:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
[...]
>> If I withdraw 20 pounds from my bank, I'll bet you that 20 pounds
>> that the bank still checks whether it has the money. I'd rather
>> write correct code than code that almost certainly happens to work.
>> Sure, strdup() is unlikely to fail-- but I'm going to check the
>> result.
>>
>>> And how often do banks fail, actually, and how often does government
>>> take action when it's heading that way, but nowhere near failing yet?
>> The government isn't going to intervene when your laptop is running
>> low on memory.
>>
> No, it's an analogy. You run lots of apps gobbling lots of memory, and
> maybe a program won't launch or thngs start to slow or a warning comes
> up, and you realise that soon the program of interest might run out of
> memory, and so you shut other things down so that that doesn't happen.
> And so it's pretty rare to actually run out of memory unless the
> program isn't correct and there is a leak.

Are you relying in a person sitting in front of the computer and
noticing that memory is running low? The vast majority of software
doesn't have someone watching it.

I agree that an allocation failure in strdup() is unlikely. Are you
suggesting that that means you needn't bother checking the result?

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: avoiding strdup()

<usqlsu$hqqv$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34323&group=comp.lang.c#34323

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Tue, 12 Mar 2024 22:44:45 +0000
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <usqlsu$hqqv$1@dont-email.me>
References: <us0brl$246bf$1@dont-email.me> <usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com> <20240310101101.00001fd4@yahoo.com>
<20240310100715.866@kylheku.com> <ifnHN.386274$vFZa.250421@fx13.iad>
<usnb64$3n297$1@dont-email.me> <yMGHN.481214$PuZ9.381006@fx11.iad>
<usoa6a$3tqji$1@dont-email.me> <87sf0w8cux.fsf@nosuchdomain.example.com>
<ZV_HN.561554$xHn7.260048@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Mar 2024 22:44:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ed016f3d6de4e923139e945dbcc26ebc";
logging-data="584543"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IHH2EbfukS/IT0N+NPXRI6QqO6voCOiw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Xwnl4RyfhqCb0j8qETPXDUHnx+Q=
Content-Language: en-GB
In-Reply-To: <ZV_HN.561554$xHn7.260048@fx14.iad>
 by: Malcolm McLean - Tue, 12 Mar 2024 22:44 UTC

On 12/03/2024 15:55, Scott Lurndal wrote:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>> On 11/03/2024 17:00, Scott Lurndal wrote:
>>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>>> On 10/03/2024 18:47, Scott Lurndal wrote:
>>>>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>>>>> On 2024-03-10, Michael S <already5chosen@yahoo.com> wrote:
>>>>>>>> On Sat, 09 Mar 2024 16:37:19 -0800
>>>>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>>>>>> strdup() and strndup() are being added to the C23 standard.
>>>>>>>>>
>>>>>>>>
>>>>>>>> What is justification?
>>>>>>>
>>>>>>> strdup is required by POSIX already and thus widely implemented.
>>>>>>> Many programmers who are not into standards already assume it's in C.
>>>>>>>
>>>>>>> For decades, portable programs have been doing things like this:
>>>>>>>
>>>>>>> #if HAVE_STRDUP
>>>>>>> #define xstrdup(s) strdup(s)
>>>>>>> #else
>>>>>>> char *xstrdup(const char *); // own definition
>>>>>>> #endif
>>>>>>>
>>>>>>>> What strdup() can do better, for any chosen value of better, than
>>>>>>>> strlen()+malloc()+memcpy() ?
>>>>>>>
>>>>>>> Not take up space in every application for a common library routine.
>>>>>>
>>>>>> It's a form of lazy programming. I've seen a lot of open source
>>>>>> code that uses strdup without checking for failure and frequently
>>>>>> "forgetting" to free the result.
>>>>>
>>>>> And it is probably more likely that machine with many gigabytes of RAM
>>>> Actually, your assumptions that:
>>>> 1) strdup is the only allocation function used by an application
>>>> 2) all strings are "short"
>>>> are both flawed.
>>>>
>>> The bank has many billions. But there is a banking crisis on and it is
>>> about to fail. And someone, somewhere, will be that man who tries to
>>> withdraw some money and is told "no". But how likely is that man to be
>>> you with your 20 pounds at the cashpoint? How likely is it to be
>>> another bank making a cash call for a 100 million or so?
>>
>> If I withdraw 20 pounds from my bank, I'll bet you that 20 pounds that
>> the bank still checks whether it has the money.
>
> And as for "how likely it is that the bank will not be able
> to honor withdrawal requests", I refer Malcolm to 1931.
>
> "In 1930, 1,352 banks held more than $853 million in
> deposits; in 1931, one year later, 2,294 banks failed
> with nearly $1.7 billion in deposits."
>
So 2,294 Americans in 1932 had the experience "you want to withdraw
cash? OK, here we go, oh sorry, that just took us over the edge and the
bank is now closed". Everyone else, either "here's your money", or
"sorry, the bank has now closed, no more withdrawal requests".
--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: avoiding strdup()

<rT5IN.564442$xHn7.452709@fx14.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34327&group=comp.lang.c#34327

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: avoiding strdup()
Newsgroups: comp.lang.c
References: <us0brl$246bf$1@dont-email.me> <ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me> <87r0gizzuo.fsf@nosuchdomain.example.com> <20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com> <ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me> <yMGHN.481214$PuZ9.381006@fx11.iad> <usoa6a$3tqji$1@dont-email.me> <87sf0w8cux.fsf@nosuchdomain.example.com> <ZV_HN.561554$xHn7.260048@fx14.iad> <usqlsu$hqqv$1@dont-email.me>
Lines: 70
Message-ID: <rT5IN.564442$xHn7.452709@fx14.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 12 Mar 2024 23:50:47 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 12 Mar 2024 23:50:47 GMT
X-Received-Bytes: 4205
 by: Scott Lurndal - Tue, 12 Mar 2024 23:50 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>On 12/03/2024 15:55, Scott Lurndal wrote:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>> On 11/03/2024 17:00, Scott Lurndal wrote:
>>>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>>>> On 10/03/2024 18:47, Scott Lurndal wrote:
>>>>>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>>>>>> On 2024-03-10, Michael S <already5chosen@yahoo.com> wrote:
>>>>>>>>> On Sat, 09 Mar 2024 16:37:19 -0800
>>>>>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>>>>>>> strdup() and strndup() are being added to the C23 standard.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> What is justification?
>>>>>>>>
>>>>>>>> strdup is required by POSIX already and thus widely implemented.
>>>>>>>> Many programmers who are not into standards already assume it's in C.
>>>>>>>>
>>>>>>>> For decades, portable programs have been doing things like this:
>>>>>>>>
>>>>>>>> #if HAVE_STRDUP
>>>>>>>> #define xstrdup(s) strdup(s)
>>>>>>>> #else
>>>>>>>> char *xstrdup(const char *); // own definition
>>>>>>>> #endif
>>>>>>>>
>>>>>>>>> What strdup() can do better, for any chosen value of better, than
>>>>>>>>> strlen()+malloc()+memcpy() ?
>>>>>>>>
>>>>>>>> Not take up space in every application for a common library routine.
>>>>>>>
>>>>>>> It's a form of lazy programming. I've seen a lot of open source
>>>>>>> code that uses strdup without checking for failure and frequently
>>>>>>> "forgetting" to free the result.
>>>>>>
>>>>>> And it is probably more likely that machine with many gigabytes of RAM
>>>>> Actually, your assumptions that:
>>>>> 1) strdup is the only allocation function used by an application
>>>>> 2) all strings are "short"
>>>>> are both flawed.
>>>>>
>>>> The bank has many billions. But there is a banking crisis on and it is
>>>> about to fail. And someone, somewhere, will be that man who tries to
>>>> withdraw some money and is told "no". But how likely is that man to be
>>>> you with your 20 pounds at the cashpoint? How likely is it to be
>>>> another bank making a cash call for a 100 million or so?
>>>
>>> If I withdraw 20 pounds from my bank, I'll bet you that 20 pounds that
>>> the bank still checks whether it has the money.
>>
>> And as for "how likely it is that the bank will not be able
>> to honor withdrawal requests", I refer Malcolm to 1931.
>>
>> "In 1930, 1,352 banks held more than $853 million in
>> deposits; in 1931, one year later, 2,294 banks failed
>> with nearly $1.7 billion in deposits."
>>
>So 2,294 Americans in 1932 had the experience "you want to withdraw
>cash? OK, here we go, oh sorry, that just took us over the edge and the
>bank is now closed". Everyone else, either "here's your money", or
>"sorry, the bank has now closed, no more withdrawal requests".

I'm pretty sure the quote above from Wikipedia is written in
a form of English that even the English understand, so I don't see
how you came up with the idea that only 2,294 Americans were
affected when 2,294 banks failed.

Nor to I see the relevence to checking the return value
of strdup(3).

Re: avoiding strdup()

<usrlkt$r66p$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34333&group=comp.lang.c#34333

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Wed, 13 Mar 2024 03:46:37 -0400
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <usrlkt$r66p$2@dont-email.me>
References: <us0brl$246bf$1@dont-email.me> <ushea7$28prq$2@dont-email.me>
<ushnkb$1rnlb$4@dont-email.me> <87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com>
<ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<yMGHN.481214$PuZ9.381006@fx11.iad> <usoa6a$3tqji$1@dont-email.me>
<87sf0w8cux.fsf@nosuchdomain.example.com> <ZV_HN.561554$xHn7.260048@fx14.iad>
<usqlsu$hqqv$1@dont-email.me> <rT5IN.564442$xHn7.452709@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Mar 2024 07:46:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6cb70556f80bfaf12b0556a734c4370e";
logging-data="891097"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+K98K8ddCMJ+NmFzqnzJx27BCl9Xqsujw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:9YjLVfH1Ume1VRC+e0kqBVk8iis=
In-Reply-To: <rT5IN.564442$xHn7.452709@fx14.iad>
Content-Language: en-US
 by: James Kuyper - Wed, 13 Mar 2024 07:46 UTC

On 3/12/24 19:50, Scott Lurndal wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
....
>> So 2,294 Americans in 1932 had the experience "you want to withdraw
>> cash? OK, here we go, oh sorry, that just took us over the edge and the
>> bank is now closed". Everyone else, either "here's your money", or
>> "sorry, the bank has now closed, no more withdrawal requests".
>
> I'm pretty sure the quote above from Wikipedia is written in
> a form of English that even the English understand, so I don't see
> how you came up with the idea that only 2,294 Americans were
> affected when 2,294 banks failed.

Every bank fails at some particular time, when it runs out of money.
There is always one particular claim on that bank's resources that
caused it to run out and for some reason he's focusing on those claims.
Other Americans also had problems due to the bank having already failed,
but at most 2294 Americans made claims that actually triggered that
failure. I haven't a clue as to why he considers that fact important,
but he has correctly made that distinction.

Actually, it may be that in some cases a bank closed immediately as soon
as a successful withdrawal request left it with too little funds, so the
number might actually be less that 2294.

> Nor to I see the relevence to checking the return value
> of strdup(3).

Agreed.

Re: avoiding strdup()

<usrst4$sqrc$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34335&group=comp.lang.c#34335

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Wed, 13 Mar 2024 09:50:28 +0000
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <usrst4$sqrc$1@dont-email.me>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<ushea7$28prq$2@dont-email.me> <ushnkb$1rnlb$4@dont-email.me>
<87r0gizzuo.fsf@nosuchdomain.example.com> <20240310101101.00001fd4@yahoo.com>
<20240310100715.866@kylheku.com> <ifnHN.386274$vFZa.250421@fx13.iad>
<usnb64$3n297$1@dont-email.me> <yMGHN.481214$PuZ9.381006@fx11.iad>
<usoa6a$3tqji$1@dont-email.me> <87sf0w8cux.fsf@nosuchdomain.example.com>
<uspt19$c2he$1@dont-email.me> <87cyrz84l0.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Mar 2024 09:50:28 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="646c19c1d101a5b948b0cd8e8b4ee1d2";
logging-data="945004"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yHWChXeYINT94gNYBIEsbzr+kauL8iSE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:l4fgOnremi73NK+m1ZSFqFWbEYk=
Content-Language: en-GB
In-Reply-To: <87cyrz84l0.fsf@nosuchdomain.example.com>
 by: Malcolm McLean - Wed, 13 Mar 2024 09:50 UTC

On 12/03/2024 22:31, Keith Thompson wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>> On 12/03/2024 01:20, Keith Thompson wrote:
>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> [...]
>>> If I withdraw 20 pounds from my bank, I'll bet you that 20 pounds
>>> that the bank still checks whether it has the money. I'd rather
>>> write correct code than code that almost certainly happens to work.
>>> Sure, strdup() is unlikely to fail-- but I'm going to check the
>>> result.
>>>
>>>> And how often do banks fail, actually, and how often does government
>>>> take action when it's heading that way, but nowhere near failing yet?
>>> The government isn't going to intervene when your laptop is running
>>> low on memory.
>>>
>> No, it's an analogy. You run lots of apps gobbling lots of memory, and
>> maybe a program won't launch or thngs start to slow or a warning comes
>> up, and you realise that soon the program of interest might run out of
>> memory, and so you shut other things down so that that doesn't happen.
>> And so it's pretty rare to actually run out of memory unless the
>> program isn't correct and there is a leak.
>
> Are you relying in a person sitting in front of the computer and
> noticing that memory is running low? The vast majority of software
> doesn't have someone watching it.
>
The server runs out of memory once. Sometimes yes, it's "these things
happen, just get it back up". But more often. it's "Can't have that
happening again. Shut something else down we don;t really need, or maybe
buy an extra 2GB. Only ten dollars after all."

> I agree that an allocation failure in strdup() is unlikely. Are you
> suggesting that that means you needn't bother checking the result?
>
If it's genuinely the case that an electrical faiure is more likely, is
there a really a point? But for my code, the test would go in, because
it usually is intended to last for a very long time, and small memory
machines might come back into fashion (eg smaller but very cheap and
very fast, or maybe it will be used in an embedded system)
--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: avoiding strdup()

<ussfgi$10iku$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34341&group=comp.lang.c#34341

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: avoiding strdup()
Date: Wed, 13 Mar 2024 16:08:02 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <ussfgi$10iku$1@dont-email.me>
References: <us0brl$246bf$1@dont-email.me> <ushea7$28prq$2@dont-email.me>
<ushnkb$1rnlb$4@dont-email.me> <87r0gizzuo.fsf@nosuchdomain.example.com>
<20240310101101.00001fd4@yahoo.com> <20240310100715.866@kylheku.com>
<ifnHN.386274$vFZa.250421@fx13.iad> <usnb64$3n297$1@dont-email.me>
<yMGHN.481214$PuZ9.381006@fx11.iad> <usoa6a$3tqji$1@dont-email.me>
<87sf0w8cux.fsf@nosuchdomain.example.com> <ZV_HN.561554$xHn7.260048@fx14.iad>
<usqlsu$hqqv$1@dont-email.me> <rT5IN.564442$xHn7.452709@fx14.iad>
<usrlkt$r66p$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Mar 2024 15:08:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="48bdc0a10db3d8c077759fdca62ffe86";
logging-data="1067678"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/h3kx/v+gsy9kBKzrDH7ki1ohrvFi7/CQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:yLsaQpHiGGPwkpQckRVJVhu//cs=
In-Reply-To: <usrlkt$r66p$2@dont-email.me>
Content-Language: en-GB
 by: David Brown - Wed, 13 Mar 2024 15:08 UTC

On 13/03/2024 08:46, James Kuyper wrote:
> On 3/12/24 19:50, Scott Lurndal wrote:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> ...
>>> So 2,294 Americans in 1932 had the experience "you want to withdraw
>>> cash? OK, here we go, oh sorry, that just took us over the edge and the
>>> bank is now closed". Everyone else, either "here's your money", or
>>> "sorry, the bank has now closed, no more withdrawal requests".
>>
>> I'm pretty sure the quote above from Wikipedia is written in
>> a form of English that even the English understand, so I don't see
>> how you came up with the idea that only 2,294 Americans were
>> affected when 2,294 banks failed.
>
> Every bank fails at some particular time, when it runs out of money.
> There is always one particular claim on that bank's resources that
> caused it to run out and for some reason he's focusing on those claims.
> Other Americans also had problems due to the bank having already failed,
> but at most 2294 Americans made claims that actually triggered that
> failure. I haven't a clue as to why he considers that fact important,
> but he has correctly made that distinction.
>
> Actually, it may be that in some cases a bank closed immediately as soon
> as a successful withdrawal request left it with too little funds, so the
> number might actually be less that 2294.
>

There are all kinds of different scenarios possible, leading to all
sorts of different numbers for the people caught in exceptional
circumstances during bank failure. I think the least likely conceivable
possibility is to imagine that the failure of a bank is an instantaneous
event that happens in the middle of a single withdrawal.

The analogue with software would be a program with thousands of threads
running at once, across dozens of cores, on a system that is running
many such programs. Each thread will be allocating and deallocating
memory asynchronously. The system will have virtual memory, and lots of
other IO going on that affects the speed of the VM backing. To imagine
that a /single/ normal allocation attempt turns that from a fully
working system to a fully failed system is clearly absurd. And the same
applies to banks.

>> Nor to I see the relevence to checking the return value
>> of strdup(3).
>
> Agreed.

Also agreed.

Analogies are fine if they shed some light on the topic under
discussion. This one started out badly (it seems to have been a
suggestion that some bad things only occur very rarely, so you should
pretend they won't happen to you), and it got rapidly less realistic and
less relevant.

Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

<86r0gcphet.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34376&group=comp.lang.c#34376

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"
Date: Thu, 14 Mar 2024 15:39:22 -0700
Organization: A noiseless patient Spider
Lines: 90
Message-ID: <86r0gcphet.fsf@linuxsc.com>
References: <us0brl$246bf$1@dont-email.me> <us1lb5$2f4n4$1@dont-email.me> <us2lfh$2ltj3$5@dont-email.me> <us2s96$2n6h3$6@dont-email.me> <us3155$2of1i$3@dont-email.me> <us4c66$346tp$3@dont-email.me> <us5d6f$3besu$3@dont-email.me> <20240305005948.00002697@yahoo.com> <us5u16$3eidj$2@dont-email.me> <20240305111103.00003081@yahoo.com> <us8821$90p$4@dont-email.me> <20240306140214.0000449c@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="c73a7ccbfb7c95d529f92c065d1adb1d";
logging-data="1988786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19HTBosB12ZpBOFAX4KwIADix7GHSj4DFU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:QXYsWBU43LoZVfuHfjVBLo7Ovw8=
sha1:lOrmeWDO+PmQWs3HYDF9J0uN47w=
 by: Tim Rentsch - Thu, 14 Mar 2024 22:39 UTC

Michael S <already5chosen@yahoo.com> writes:

> On Tue, 5 Mar 2024 22:58:10 -0000 (UTC)
> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>
>> On Tue, 5 Mar 2024 11:11:03 +0200, Michael S wrote:
>>
>>> On Tue, 5 Mar 2024 01:54:46 -0000 (UTC)
>>> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>>
>>>> Discord did some benchmarking of its back-end servers, which had
>>>> been using Go, and decided that switching to Rust offered better
>>>> performance.
>>>
>>> - for big and complex real-world back-end processing, writing
>>> working solution in go will take 5 time less man hours than
>>> writing it in Rust
>>
>> Nevertheless, they found the switch to Rust worthwhile.
>
> I read a little more about it.
> https://discord.com/blog/why-discord-is-switching-from-go-to-rust
>
> Summary: performance of one of Discord's most heavy-duty servers
> suffered from weakness in implementation of Go garbage collector.
> [...]
>
> I have few questions about the story, most important one is
> whether the weakness of this sort is specific to GC of Go, due
> to its relative immaturity or more general and applies equally
> to most mature GCs on the market, i.e. J2EE and .NET.

After reading the article, it seems clear that the design of the
GC used in Go is not a good fit to the Discord server workload.
That is not to say that Go's GC would be a bad fit for other
workloads, only that it's not a good choice for the Discord
server. Also it seems clear that other approaches to GC design
(meant in the sense of already having been thought of and tried)
would be just fine for the Discord server. Of course whether
such schemes would be a good fit for the Go environment is
a separate question (and one about which I have nothing to
offer since I know very little about Go).

> Another question is whether the problem is specific to GC-style
> of automatic memory management (AMM) or applies, at least to
> some degree, to other forms of AMM, most importantly, to AMMs
> based on Reference Counting used by Swift and also popular in
> C++.

It's very hard to make a blanket statement that applies to all
the different approaches to garbage collection, or to other
automatic memory management schemes (with reference counting as a
specific example), in a general way. My experience with garbage
collected environments is that they are perfectly usable both for
long-term use and for interactive use. Reference counting too:
typically RC gives a smoother feel, but that comes at a cost,
because RC does not, by itself, reclaim circular structures.
That means that either, one, code must be written to break the
circularity of such structures (so memory management is not fully
automated); or two, periodically some sort of more general GC
method must be invoked to reclaim them; or three, eventually
more and more memory is used to where the application must be
rebooted (like the memory usage patterns of some popular web
browsers). The question is what kind of workloads need to be
supported - some schemes are good for typical interactive, but
short-term, applications, other schemes are better for the sort
of long-term server processes like the Discord example. The
space of already existing techniques for doing GC is pretty
large - if a particular kind of workload needs to be supported,
there is a very good chance that an appropriate GC scheme can
be found without much difficulty.

Incidentally, there is no such thing as a fully automatic memory
management system. Even full garbage collection sometimes needs
help from the programmer so all memory is eventually reclaimed.
(If you're feeling brave try doing a web search for "ephemeron".)
The point of all AMM schemes is not to reduce the amount of
programmer effort to zero but simply to greatly reduce it (and
hopefully reduce it to zero in many of the most common cases).
But for complicated programs it's almost inevitable that some
programmer-written code needs to be included to help whatever
automated mechanisms are used.

> Of course, I don't expected that my questions will be answered
> fully on comp.lang.c, but if some knowledgeable posters will try
> to answer I would appreciate.

The questions presented were somewhat general, and so the answers
given are also rather general. In spite of that I hope you found
what you're looking for.

Re: [OT] UTF-8 sig.

<20240321144727.4f56431cd25f4ce76c2fecef@gmail.moc>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34590&group=comp.lang.c#34590

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton....@gmail.moc (Anton Shepelev)
Newsgroups: comp.lang.c
Subject: Re: [OT] UTF-8 sig.
Date: Thu, 21 Mar 2024 14:47:27 +0300
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <20240321144727.4f56431cd25f4ce76c2fecef@gmail.moc>
References: <us0brl$246bf$1@dont-email.me>
<pan$4fc39$61bdfbef$3ca9a71a$af842694@invalid.invalid>
<87y1ayj6hs.fsf_-_@bsb.me.uk>
<pan$e9f7e$d6f7a386$31c353e8$a08c13cf@invalid.invalid>
<usc845$10v6e$1@dont-email.me>
<pan$89aca$33d2df8c$9e2c232f$d767db40@invalid.invalid>
<87v85vzwze.fsf@nosuchdomain.example.com>
<pan$2dd7c$14ee35e9$af2801e3$81014785@invalid.invalid>
<ushtlq$2bl9c$1@dont-email.me>
<pan$93519$1f11827c$264b9252$6ac78789@invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="0089de06f09c3e7028230bfe3077fa53";
logging-data="2300549"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19brR99J6jTGNpo4/Rh/NcAk9U+/FSlnKw="
Cancel-Lock: sha1:lXyBzMLMUjR/WSdObnrZ04MMogg=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
 by: Anton Shepelev - Thu, 21 Mar 2024 11:47 UTC

Blue-Maned_Hawk:

> --
> Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/his/himself/Mr.
> blue-maned_hawk.srht.site
> TEST

This one is readable, but I still hate UTF-8 whenever plain old ASCII
or a bilingual 8-bit encodinng would suffice.

By the way, I liked your website, including the color scheme. Pray
to not call yourself a mediocre writer: leave the observation to the
reader.

--
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments

Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

<v0mo1q$1arr4$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35163&group=comp.lang.c#35163

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: "White House to Developers: Using C or C++ Invites Cybersecurity
Risks"
Date: Mon, 29 Apr 2024 00:02:02 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <v0mo1q$1arr4$2@dont-email.me>
References: <us0brl$246bf$1@dont-email.me> <us1lb5$2f4n4$1@dont-email.me>
<us2lfh$2ltj3$5@dont-email.me> <us2s96$2n6h3$6@dont-email.me>
<us3155$2of1i$3@dont-email.me> <us4c66$346tp$3@dont-email.me>
<us5d6f$3besu$3@dont-email.me> <20240305005948.00002697@yahoo.com>
<us5u16$3eidj$2@dont-email.me> <20240305111103.00003081@yahoo.com>
<us8821$90p$4@dont-email.me> <20240306140214.0000449c@yahoo.com>
<us9nib$dski$1@dont-email.me> <20240307000008.00003544@yahoo.com>
<usc58s$10cls$1@dont-email.me> <20240307083119.850@kylheku.com>
<useegp$1ihfv$1@dont-email.me> <20240308125746.000074c1@yahoo.com>
<usf7hn$1o7fd$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Apr 2024 02:02:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="04215bbbe15e1cd8ac94ba1cee5d62b8";
logging-data="1404772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sovE+qidCxqPcYEab1szF"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:AuYIrfAFFhf2Y4Hehsh7P5SIJIw=
 by: Lawrence D'Oliv - Mon, 29 Apr 2024 00:02 UTC

On Fri, 8 Mar 2024 15:32:22 +0100, David Brown wrote:

> And it will be tough on the cache as everything has to be copied and
> moved.

I think all kinds of garbage collector end up being tough on the cache.
Because remember, they are doing things with lots of blocks of memory that
haven’t been accessed recently, and therefore are not likely to be in the
cache.

Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

<v0mo7t$1arr4$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35164&group=comp.lang.c#35164

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: "White House to Developers: Using C or C++ Invites Cybersecurity
Risks"
Date: Mon, 29 Apr 2024 00:05:17 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <v0mo7t$1arr4$3@dont-email.me>
References: <us0brl$246bf$1@dont-email.me> <us1lb5$2f4n4$1@dont-email.me>
<us2lfh$2ltj3$5@dont-email.me> <us2s96$2n6h3$6@dont-email.me>
<us3155$2of1i$3@dont-email.me> <us4c66$346tp$3@dont-email.me>
<us5d6f$3besu$3@dont-email.me> <20240305005948.00002697@yahoo.com>
<us5u16$3eidj$2@dont-email.me> <20240305111103.00003081@yahoo.com>
<us8821$90p$4@dont-email.me> <20240306140214.0000449c@yahoo.com>
<us9nib$dski$1@dont-email.me> <20240307000008.00003544@yahoo.com>
<usc58s$10cls$1@dont-email.me> <20240307134401.00007aa2@yahoo.com>
<uscmub$149j3$1@dont-email.me> <usf11f$1mk5l$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Apr 2024 02:05:17 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="04215bbbe15e1cd8ac94ba1cee5d62b8";
logging-data="1404772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MdyaINkJawdz8B6lhPWKf"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:HHEBAjGifZ7Ms46KPRc2j7/1KN4=
 by: Lawrence D'Oliv - Mon, 29 Apr 2024 00:05 UTC

On Fri, 8 Mar 2024 14:41:16 +0200, Paavo Helde wrote:

> AFAIK CPython uses reference counting ...

Combination of reference-counting as a first resort, with full garbage
collection to deal with those less common cases where you have reference
cycles. Trying to get the best of both worlds.

The trouble with reference-counting is it impacts multithreading
performance. However, the CPython developers have a scheme to deal with
this, by making the reference counts a little less deterministic (i.e.
there may be a slight delay before they become fully correct). I think
this is a complicated idea, and it may take them some time to get it fully
implemented.

Pages:12345678910
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor