Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

6 May, 2024: The networking issue during the past two days has been identified and fixed.


devel / comp.arch / On the pitfalls of C and UB: C23 seems to be even worse. :-(

SubjectAuthor
* On the pitfalls of C and UB: C23 seems to be even worse. :-(Terje Mathisen
+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
|+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
|| +- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
|| `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(David Brown
|+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Bill Findlay
||`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
|+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Anton Ertl
||+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Niklas Holsti
|||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Michael S
||| +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Michael S
||| |`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Niklas Holsti
||| +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Niklas Holsti
||| |`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Jean-Marc Bourguet
||| `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
|||`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(David Brown
|| +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Terje Mathisen
|| |+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Michael S
|| |+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(David Brown
|| |`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Tim Rentsch
|| | `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(chrisq
|| |  `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Tim Rentsch
|| `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Anton Ertl
||  +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||  |+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Anton Ertl
||  ||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||  || `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Tim Rentsch
||  ||  `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||  ||   `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Tim Rentsch
||  |`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||  `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(David Brown
||   `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Anton Ertl
||    +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Michael S
||    |+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Michael S
||    |+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Niklas Holsti
||    ||+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Michael S
||    ||`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Thomas Koenig
||    |`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Anton Ertl
||    | +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Michael S
||    | |`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | | +- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(robf...@gmail.com
||    | | `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(robf...@gmail.com
||    | |  |+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(David Brown
||    | |  |+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  |+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Timothy McCaffrey
||    | |  || +- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  || `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(David Brown
||    | |  |`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Thomas Koenig
||    | |  | +- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  | +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  | |`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Thomas Koenig
||    | |  | `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(John Dallman
||    | |  |  `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Thomas Koenig
||    | |  |   `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  |    `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(EricP
||    | |  |     `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  |      `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(EricP
||    | |  |       `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  |+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  |||+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Terje Mathisen
||    | |  ||||`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  |||+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Timothy McCaffrey
||    | |  |||+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Timothy McCaffrey
||    | |  ||||`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Stephen Fuld
||    | |  |||+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Stephen Fuld
||    | |  |||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||| +- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  ||| `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  |||  `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  || +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  || |`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  || | `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  || |  +- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  || |  `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Terje Mathisen
||    | |  || |   `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  || `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(John Dallman
||    | |  ||  `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  ||   +* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||   |+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Terje Mathisen
||    | |  ||   ||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||   || `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Terje Mathisen
||    | |  ||   |+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  ||   ||+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||   |||+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  ||   ||||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||   |||| `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  ||   |||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Tim Rentsch
||    | |  ||   ||| `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(chrisq
||    | |  ||   ||`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  ||   || `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(BGB
||    | |  ||   ||  `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Stephen Fuld
||    | |  ||   ||   `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Scott Lurndal
||    | |  ||   |`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Thomas Koenig
||    | |  ||   `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(John Dallman
||    | |  |`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | |  `* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(MitchAlsup
||    | +- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Michael S
||    | `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Thomas Koenig
||    +- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(David Brown
||    `- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Mike Stump
|+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Thomas Koenig
|`- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(John Dallman
+* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Andy Valencia
+- Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Thomas Koenig
+* Re: C !!num idiom [was On the pitfalls of C and UB: C23 seems toEricP
`* Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(Peter Lund

Pages:123456789
On the pitfalls of C and UB: C23 seems to be even worse. :-(

<u0f6gf$32irr$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31477&group=comp.arch#31477

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: terje.ma...@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Mon, 3 Apr 2023 20:39:11 +0200
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <u0f6gf$32irr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 3 Apr 2023 18:39:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1025db58faec9726c63a3cb695d22b0d";
logging-data="3230587"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/bMZPqsga2Aj/uYtOMQfY5+yjVOrpMIylvsua6QemcGA=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.15
Cancel-Lock: sha1:ZUtE0mtFNrfc4weuXQe5m2i1q0o=
X-Mozilla-News-Host: snews://news.eternal-september.org:563
 by: Terje Mathisen - Mon, 3 Apr 2023 18:39 UTC

https://queue.acm.org/detail.cfm?id=3588242

Terje
--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31478&group=comp.arch#31478

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:1711:b0:746:af25:7e8a with SMTP id az17-20020a05620a171100b00746af257e8amr147963qkb.14.1680556935994;
Mon, 03 Apr 2023 14:22:15 -0700 (PDT)
X-Received: by 2002:a05:6808:bcf:b0:387:5a8c:4125 with SMTP id
o15-20020a0568080bcf00b003875a8c4125mr178684oik.3.1680556935619; Mon, 03 Apr
2023 14:22:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!nntp.club.cc.cmu.edu!45.76.7.193.MISMATCH!3.us.feeder.erje.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 3 Apr 2023 14:22:15 -0700 (PDT)
In-Reply-To: <u0f6gf$32irr$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:6c65:606e:7226:bbdb;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:6c65:606e:7226:bbdb
References: <u0f6gf$32irr$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Mon, 03 Apr 2023 21:22:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3230
 by: MitchAlsup - Mon, 3 Apr 2023 21:22 UTC

On Monday, April 3, 2023 at 1:39:14 PM UTC-5, Terje Mathisen wrote:
> https://queue.acm.org/detail.cfm?id=3588242
<
In my 38 years of writing C code, I, personally, have never used realloc()
(or calloc() BTW).
<
In all my future years of programming, I do not expect to compare pointers.
I haven't compared a pointer for the first 53 years of programming, why start
now ? Apparently I have a knack of writing code using pointers that does not
need pointer comparisons.
<
Also note: For the last 52 years I have not programmed a machine where
comparing pointers was "tricky"--I never used the segment stuff in x86-32.
{and thus remain un-brain-damaged or is that un-dame-bramaged.}
<
For the foreseeable future; I will not use machines that have tricky pointers.
The set of such machines are at least {x86-64, ARM, RISC-V, MIPS, VAX,
PDP-11, Nova, SPARC, IBM 360-3090, Mc 68K, Mc 88K, .....} It is not like you
are hurting your access to machines and architectures by making pointer
comparisons "easy".
<
Nor do I care if the C standards committee persists in seeing that C remains
compatible with architectures that are fundamentally against the large flat
linear address space.
<
Can we face facts: The large flat linear address space model has won--
Just like Little Endian has won--and that comparing pointers in a large
flat linear address space is "easy" and there is no reason to make the
language "special" in this way. Better to make the non LFLAS models
pay the cost (are there any left?? If there are, why can't they continue
to use C11 ??)
<
Now, I understand that languages have to evolve forward, And I, for one,
do not care that C23 is migrating even farther from C++, I might even
consider that a GOOD THING !!!
<
I still think in terms of K&R C, but have migrated to using the uinit46_t
spellings for typing.
>
> Terje
> --
> - <Terje.Mathisen at tmsw.no>
> "almost all programming can be viewed as an exercise in caching"

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<rFHWL.168802$5jd8.43928@fx05.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31480&group=comp.arch#31480

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx05.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: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Newsgroups: comp.arch
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
Lines: 31
Message-ID: <rFHWL.168802$5jd8.43928@fx05.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 03 Apr 2023 21:36:23 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 03 Apr 2023 21:36:23 GMT
X-Received-Bytes: 1872
 by: Scott Lurndal - Mon, 3 Apr 2023 21:36 UTC

MitchAlsup <MitchAlsup@aol.com> writes:
>On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
>> https://queue.acm.org/detail.cfm?id=3D3588242=20
><
>In my 38 years of writing C code, I, personally, have never used realloc()
>(or calloc() BTW).

Likewise, albeit in 43 years of C programming.

><
>In all my future years of programming, I do not expect to compare pointers.

Except when comparing them to the null pointer (NULL), which technically
is 'comparing pointers' given the definition of NULL is usually (void *)0.

>I haven't compared a pointer for the first 53 years of programming, why sta=
>rt
>now ? Apparently I have a knack of writing code using pointers that does no=
>t
>need pointer comparisons.
><
>Also note: For the last 52 years I have not programmed a machine where
>comparing pointers was "tricky"--I never used the segment stuff in x86-32.
>{and thus remain un-brain-damaged or is that un-dame-bramaged.}

Unfortunately, the Burroughs mainframes I programmed had an
odd segmentation scheme (designed to allow backward compatability
with 1,000,000 digit address space limits from the original early
60's design, so pointers were rather tricky).

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<38460018-a033-41af-85a1-495e06670c19n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31482&group=comp.arch#31482

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:6214:4a4f:b0:5a3:c914:3511 with SMTP id ph15-20020a0562144a4f00b005a3c9143511mr58329qvb.4.1680558304808;
Mon, 03 Apr 2023 14:45:04 -0700 (PDT)
X-Received: by 2002:a05:6808:695:b0:389:86c3:b1fb with SMTP id
k21-20020a056808069500b0038986c3b1fbmr195507oig.9.1680558304471; Mon, 03 Apr
2023 14:45:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 3 Apr 2023 14:45:04 -0700 (PDT)
In-Reply-To: <rFHWL.168802$5jd8.43928@fx05.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:6c65:606e:7226:bbdb;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:6c65:606e:7226:bbdb
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<rFHWL.168802$5jd8.43928@fx05.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <38460018-a033-41af-85a1-495e06670c19n@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Mon, 03 Apr 2023 21:45:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3130
 by: MitchAlsup - Mon, 3 Apr 2023 21:45 UTC

On Monday, April 3, 2023 at 4:36:27 PM UTC-5, Scott Lurndal wrote:
> MitchAlsup <Mitch...@aol.com> writes:
> >On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
> >> https://queue.acm.org/detail.cfm?id=3D3588242=20
> ><
> >In my 38 years of writing C code, I, personally, have never used realloc()
> >(or calloc() BTW).
> Likewise, albeit in 43 years of C programming.
> ><
> >In all my future years of programming, I do not expect to compare pointers.
> Except when comparing them to the null pointer (NULL), which technically
> is 'comparing pointers' given the definition of NULL is usually (void *)0..
<
Yes, but when written::
<
if( p ) { dereference( p ); }
or
if( !p ) { avoid_dereferencing( p ); }
<
it is not a comparison !!
<
{{ I fully agree that it is TECHNICALLY and PEDANTICALLY a comparison;
but it does not have a comparison operator in the source............................}}
>
>
> >I haven't compared a pointer for the first 53 years of programming, why sta=
> >rt
> >now ? Apparently I have a knack of writing code using pointers that does no> >t
> >need pointer comparisons.
> ><
> >Also note: For the last 52 years I have not programmed a machine where
> >comparing pointers was "tricky"--I never used the segment stuff in x86-32.
> >{and thus remain un-brain-damaged or is that un-dame-bramaged.}
<
> Unfortunately, the Burroughs mainframes I programmed had an
> odd segmentation scheme (designed to allow backward compatability
> with 1,000,000 digit address space limits from the original early
> 60's design, so pointers were rather tricky).
<
Never programmed on one (except in algol60 which likely does not count ).

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<0001HW.29DB87A300295C0D30E2A938F@news.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31485&group=comp.arch#31485

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: findlayb...@blueyonder.co.uk (Bill Findlay)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Mon, 03 Apr 2023 23:16:03 +0100
Organization: none
Lines: 13
Message-ID: <0001HW.29DB87A300295C0D30E2A938F@news.individual.net>
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
Reply-To: findlaybill@blueyonder.co.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: individual.net yClKWqv4NBZq2+vyYJrPYAbEeVny/w0av5IGZs0vm0I6NxBavM
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:Aky1muapb2WjjV1cu/PI3vofSWQ=
User-Agent: Hogwasher/5.24
 by: Bill Findlay - Mon, 3 Apr 2023 22:16 UTC

On 3 Apr 2023, MitchAlsup wrote
(in article<a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>):

> I still think in terms of K&R C, but have migrated to using the
> uinit46_t
> spellings for typing.

Is that one of Quadibloc's types? 8-)

--
Bill Findlay

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<12443c79-eb92-4c51-bf96-49c8ea95c773n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31486&group=comp.arch#31486

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:1994:b0:749:5487:52de with SMTP id bm20-20020a05620a199400b00749548752demr285101qkb.7.1680567712763;
Mon, 03 Apr 2023 17:21:52 -0700 (PDT)
X-Received: by 2002:a05:6820:549:b0:53f:136a:13d0 with SMTP id
n9-20020a056820054900b0053f136a13d0mr467153ooj.0.1680567712541; Mon, 03 Apr
2023 17:21:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 3 Apr 2023 17:21:52 -0700 (PDT)
In-Reply-To: <0001HW.29DB87A300295C0D30E2A938F@news.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:6c65:606e:7226:bbdb;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:6c65:606e:7226:bbdb
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<0001HW.29DB87A300295C0D30E2A938F@news.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <12443c79-eb92-4c51-bf96-49c8ea95c773n@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Tue, 04 Apr 2023 00:21:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: MitchAlsup - Tue, 4 Apr 2023 00:21 UTC

On Monday, April 3, 2023 at 5:16:07 PM UTC-5, Bill Findlay wrote:
> On 3 Apr 2023, MitchAlsup wrote
> (in article<a533d5c4-8dca-44eb...@googlegroups.com>):
> > I still think in terms of K&R C, but have migrated to using the
> > uinit46_t
> > spellings for typing.
> Is that one of Quadibloc's types? 8-)
<
yes and Woops !!
>
> --
> Bill Findlay

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<168057862503.27325.13559172660210279577@media.vsta.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31488&group=comp.arch#31488

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!news.mixmin.net!news2.arglkargh.de!news.karotte.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: van...@vsta.org (Andy Valencia)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Mon, 03 Apr 2023 20:23:45 -0700
Lines: 11
Message-ID: <168057862503.27325.13559172660210279577@media.vsta.org>
References: <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com> <u0f6gf$32irr$1@dont-email.me>
X-Trace: individual.net uQF3+2C8rzne1bj6gq8SiAidOfjqnzoq8tzoV+QViPvUmJ5z/K
X-Orig-Path: media
Cancel-Lock: sha1:vw4Rob5ZiC21WKT8lE/TG23kPK4=
User-Agent: rn.py v0.0.1
 by: Andy Valencia - Tue, 4 Apr 2023 03:23 UTC

MitchAlsup <MitchAlsup@aol.com> writes:
> In my 38 years of writing C code, I, personally, have never used realloc()
> (or calloc() BTW).

So if you have a list of, I don't know, int's, and you add one more to the
list. What do you do instead of realloc() it to make room for another
addition?

Andy Valencia
Home page: https://www.vsta.org/andy/
To contact me: https://www.vsta.org/contact/andy.html

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<u0gcmv$3b0os$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31489&group=comp.arch#31489

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-cbb6-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Tue, 4 Apr 2023 05:31:11 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <u0gcmv$3b0os$1@newsreader4.netcologne.de>
References: <u0f6gf$32irr$1@dont-email.me>
Injection-Date: Tue, 4 Apr 2023 05:31:11 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-cbb6-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:cbb6:0:7285:c2ff:fe6c:992d";
logging-data="3506972"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 4 Apr 2023 05:31 UTC

Terje Mathisen <terje.mathisen@tmsw.no> schrieb:
> https://queue.acm.org/detail.cfm?id=3588242

While I agree C could be better (who doesn't?) there are some
points in the article that I disagree with, others I agree with.

Paywalls - yes, that's a nuisance. Fortunately, as the article
implies, draft copies exist. (Not of the IEEE 754 standard,
it appears).

New keywords outside of the reserved space (leading underscores)
in a language like C, which reserves keywords, are not a good
idea in general because they tend to break existing code. I like
Fortran's approach better in such a case.

unreachable - I don't see the problem here. Removing code that
is not reachable where one branch has unreachable and all other
branches before also do not return is fine. It seems the authors
do not expect programmers to read or understand the control flow
of their programs.

realloc of zero-sized objects: Arguments on both sides. Breaking
existing code is bad, but having zero-size objects is something
I like (cf. Fortran, where these are first-class citicens).
I'd probably come down on the "don't change" side.

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<u0ge1f$3ao48$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31490&group=comp.arch#31490

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Tue, 4 Apr 2023 00:53:49 -0500
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <u0ge1f$3ao48$1@dont-email.me>
References: <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<u0f6gf$32irr$1@dont-email.me>
<168057862503.27325.13559172660210279577@media.vsta.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 4 Apr 2023 05:53:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8c0cfbe3c606a47c4dc61f1a32bbe340";
logging-data="3498120"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192Q0EeCxNLCpQU2OmcQBYU"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Cancel-Lock: sha1:dOYLi9XG4KLWFtK6WSaud7CyUq4=
In-Reply-To: <168057862503.27325.13559172660210279577@media.vsta.org>
Content-Language: en-US
 by: BGB - Tue, 4 Apr 2023 05:53 UTC

On 4/3/2023 10:23 PM, Andy Valencia wrote:
> MitchAlsup <MitchAlsup@aol.com> writes:
>> In my 38 years of writing C code, I, personally, have never used realloc()
>> (or calloc() BTW).
>
> So if you have a list of, I don't know, int's, and you add one more to the
> list. What do you do instead of realloc() it to make room for another
> addition?
>

I use realloc() and pointer comparison fairly often, among other things.

Of course, I haven't been writing code for quite that long...

I didn't do a whole lot of coding in my early years, not really getting
much into programming until after I was in elementary school (originally
in QBasic during the MS-DOS and Win 3.x era; started learning C by late
elem...). Much before that, it was a chaotic time that I don't really
remember.

But, yeah, didn't really entirely switch over to C until roughly middle
school, then mostly using a computer set to dual boot Linux and Windows
NT4, using Cygwin on the latter (before then switching over to Win2K and
using this for pretty much all of high school; during the era where for
most people Win98 started to give way to WinXP).

Prior to Linux+NT4, had been using Win95, but a great HDD crash lost
everything I had prior to this point. I think I went over to NT4 mostly
because I didn't want to reinstall Win95, and Win98's instability didn't
exactly appeal to me much either (at the time, another PC in the house
had been running Win98, so was already familiar with it).

But, all this was many decades ago... (and I am much older now...).

So, say, maybe 25 years of C coding, +/- a little...

> Andy Valencia
> Home page: https://www.vsta.org/andy/
> To contact me: https://www.vsta.org/contact/andy.html

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<bbeefe5b-568f-4158-b1ce-12003249e0d4n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31491&group=comp.arch#31491

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:1721:b0:745:70ea:4fe6 with SMTP id az33-20020a05620a172100b0074570ea4fe6mr504999qkb.6.1680588627854;
Mon, 03 Apr 2023 23:10:27 -0700 (PDT)
X-Received: by 2002:a9d:6ac7:0:b0:68b:e0dc:abc7 with SMTP id
m7-20020a9d6ac7000000b0068be0dcabc7mr515920otq.4.1680588627502; Mon, 03 Apr
2023 23:10:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 3 Apr 2023 23:10:27 -0700 (PDT)
In-Reply-To: <u0ge1f$3ao48$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=99.251.79.92; posting-account=QId4bgoAAABV4s50talpu-qMcPp519Eb
NNTP-Posting-Host: 99.251.79.92
References: <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<u0f6gf$32irr$1@dont-email.me> <168057862503.27325.13559172660210279577@media.vsta.org>
<u0ge1f$3ao48$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bbeefe5b-568f-4158-b1ce-12003249e0d4n@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: robfi...@gmail.com (robf...@gmail.com)
Injection-Date: Tue, 04 Apr 2023 06:10:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3768
 by: robf...@gmail.com - Tue, 4 Apr 2023 06:10 UTC

On Tuesday, April 4, 2023 at 1:53:55 AM UTC-4, BGB wrote:
> On 4/3/2023 10:23 PM, Andy Valencia wrote:
> > MitchAlsup <Mitch...@aol.com> writes:
> >> In my 38 years of writing C code, I, personally, have never used realloc()
> >> (or calloc() BTW).
> >
> > So if you have a list of, I don't know, int's, and you add one more to the
> > list. What do you do instead of realloc() it to make room for another
> > addition?
> >
> I use realloc() and pointer comparison fairly often, among other things.
>
> Of course, I haven't been writing code for quite that long...
>
>
> I didn't do a whole lot of coding in my early years, not really getting
> much into programming until after I was in elementary school (originally
> in QBasic during the MS-DOS and Win 3.x era; started learning C by late
> elem...). Much before that, it was a chaotic time that I don't really
> remember.
>
> But, yeah, didn't really entirely switch over to C until roughly middle
> school, then mostly using a computer set to dual boot Linux and Windows
> NT4, using Cygwin on the latter (before then switching over to Win2K and
> using this for pretty much all of high school; during the era where for
> most people Win98 started to give way to WinXP).
>
> Prior to Linux+NT4, had been using Win95, but a great HDD crash lost
> everything I had prior to this point. I think I went over to NT4 mostly
> because I didn't want to reinstall Win95, and Win98's instability didn't
> exactly appeal to me much either (at the time, another PC in the house
> had been running Win98, so was already familiar with it).
>
>
> But, all this was many decades ago... (and I am much older now...).
>
> So, say, maybe 25 years of C coding, +/- a little...
> > Andy Valencia
> > Home page: https://www.vsta.org/andy/
> > To contact me: https://www.vsta.org/contact/andy.html

I do not use pointer comparison at all AFAIK. I do check for NULL pointers though.
Quite often use comparisons of objects pointed to, as in. p1->object == p2->object.
Because one does not generally know where in the heap an allocated object is
going to end up, it is not that useful to compare pointers for most code. I think I
have seen some code for garbage collection that compares pointers, but that is
a rare case.

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<2023Apr4.073909@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31492&group=comp.arch#31492

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Tue, 04 Apr 2023 05:39:09 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 80
Message-ID: <2023Apr4.073909@mips.complang.tuwien.ac.at>
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
Injection-Info: dont-email.me; posting-host="fc2558d5f54dd1412644b8437be1c032";
logging-data="3507310"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rITPfyVmDUjdf5NW4EYJz"
Cancel-Lock: sha1:MPhMjo2NpoMBvwR4q7hEEMM0aCE=
X-newsreader: xrn 10.11
 by: Anton Ertl - Tue, 4 Apr 2023 05:39 UTC

MitchAlsup <MitchAlsup@aol.com> writes:
>On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
>> https://queue.acm.org/detail.cfm?id=3D3588242=20
><
>In my 38 years of writing C code, I, personally, have never used realloc()
>(or calloc() BTW).

I have.

>In all my future years of programming, I do not expect to compare pointers.
>I haven't compared a pointer for the first 53 years of programming, why sta=
>rt
>now ?

One reason for comparing pointers is if you want to implement
memmove(), as discussed in the article.

Another one (this one within standard-C confines) is walking through
an array with an idiom like this:

for (p=start; p<end; p++)
... *p ...

Another one was when unifying two free logic variables in a Prolog
implementation. We do this by letting one logic variable point to the
other, but which should point to which? The newer one should point to
the older, because the newer one may be deallocated earlier. With
stack allocation, we can find out by pointer comparison which one may
be deallocated earlier. If the stack was a single object in standard
C terms, this might be within its confines, but of course the Prolog
implementation (like pretty much all other production programs)
contained other things that have not been standardized in C, but which
the compilers of the day used to compile as intended.

In another case I needed an arbitrary total order of the objects (I
don't remember for what purpose), and the addresses of the objects
conveniently provided an order while the contents didn't. I remember
that this was in a Forth program, and in standard Forth you can
compare addresses.

>For the foreseeable future; I will not use machines that have tricky pointe=
>rs.
>The set of such machines are at least {x86-64, ARM, RISC-V, MIPS, VAX,
>PDP-11, Nova, SPARC, IBM 360-3090, Mc 68K, Mc 88K, .....}

I think you mean that these are machines that do not have tricky
pointers.

You do not mention IA-32. Is there any OS that exposes the potential
tricky pointers of IA-32 to user-level code?

One interesting aspect of the way IA-32 was designed was that they had
the segments as potentially overlapping extents in a 32-bit linear
address space.

My current take would be to treat the segments like ASIDs, i.e.,
extend the 32-bit address with 13 additional bits from the segment and
have a paging system that maps these 45-bit addresses to physical
memory; i.e., segments would be non-overlapping in this 45-bit address
space (paging could result in several segments sharing pages, and a
Unix would use this to implement, e.g., COW). This might have made it
unnecessary to add the PCID later. I guess it would not have
precluded PAE, unless they had catered for longer physical addresses
from the start. I have not worked out the ramifications of this idea,
so I might change my opinion once I have.

>Can we face facts: The large flat linear address space model has won--
>Just like Little Endian has won--and that comparing pointers in a large
>flat linear address space is "easy" and there is no reason to make the
>language "special" in this way. Better to make the non LFLAS models
>pay the cost (are there any left?? If there are, why can't they continue=20
>to use C11 ??)

C11, C99, and C89 are not any better wrt. comparing pointers. If you
want a language that has a flat address space, use Forth.

- anton
--
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<u0gh1d$3b3gc$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31493&group=comp.arch#31493

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-cbb6-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Tue, 4 Apr 2023 06:45:01 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <u0gh1d$3b3gc$1@newsreader4.netcologne.de>
References: <u0f6gf$32irr$1@dont-email.me>
<a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 4 Apr 2023 06:45:01 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-cbb6-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:cbb6:0:7285:c2ff:fe6c:992d";
logging-data="3509772"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 4 Apr 2023 06:45 UTC

MitchAlsup <MitchAlsup@aol.com> schrieb:
> On Monday, April 3, 2023 at 1:39:14 PM UTC-5, Terje Mathisen wrote:
>> https://queue.acm.org/detail.cfm?id=3588242
><
> In my 38 years of writing C code, I, personally, have never used realloc()
> (or calloc() BTW).

Reading a line of arbitrary length (getline) is the canonical example,
I think.

[...]

> Can we face facts: The large flat linear address space model has won--
> Just like Little Endian has won--

With the difference that there are no longer segmented machines on the
market, and big-endian machines are still being sold. Less than before,
sure (and I don't think we will ever see a little-endian zSystem).

[...]

> Now, I understand that languages have to evolve forward, And I, for one,
> do not care that C23 is migrating even farther from C++, I might even
> consider that a GOOD THING !!!

The common subset isn't bad. C++ has been suffering from feature
stampede for decades...

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<k928b4F2cleU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31494&group=comp.arch#31494

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!rocksolid2!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Tue, 4 Apr 2023 12:18:28 +0300
Organization: Tidorum Ltd
Lines: 19
Message-ID: <k928b4F2cleU1@mid.individual.net>
References: <u0f6gf$32irr$1@dont-email.me>
<a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<2023Apr4.073909@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net qGXw4uX6eiLPX3clr3ypzAcKgp7MMU0KQ0zBhR2//k/k8FG9lD
Cancel-Lock: sha1:Waa8qKkvY1A5EnQmyXNw9O2wWiE=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0)
Gecko/20100101 Thunderbird/102.6.1
Content-Language: en-US
In-Reply-To: <2023Apr4.073909@mips.complang.tuwien.ac.at>
 by: Niklas Holsti - Tue, 4 Apr 2023 09:18 UTC

On 2023-04-04 8:39, Anton Ertl wrote:
> MitchAlsup <MitchAlsup@aol.com> writes:
>> On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
>>> https://queue.acm.org/detail.cfm?id=3D3588242=20

[ snip ]

> C11, C99, and C89 are not any better wrt. comparing pointers. If you
> want a language that has a flat address space, use Forth.

Or use Ada. While you can compare Ada pointers ("access values") only
for equality, you can take the address of any object and compare
addresses in any way you like (=, <, >, ...). You can also convert an
address to a (dedicated predefined) integer type, do arithmetic on it,
and then convert the result back to an address or a pointer.

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<16efa53a-1919-42dc-9f24-4778c405f09bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31495&group=comp.arch#31495

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:410d:b0:748:6dd0:5b62 with SMTP id j13-20020a05620a410d00b007486dd05b62mr742222qko.5.1680610906445;
Tue, 04 Apr 2023 05:21:46 -0700 (PDT)
X-Received: by 2002:a05:6870:5828:b0:17a:b31c:9e1e with SMTP id
r40-20020a056870582800b0017ab31c9e1emr1232947oap.1.1680610906075; Tue, 04 Apr
2023 05:21:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 4 Apr 2023 05:21:45 -0700 (PDT)
In-Reply-To: <k928b4F2cleU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=199.203.251.52; posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 199.203.251.52
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<2023Apr4.073909@mips.complang.tuwien.ac.at> <k928b4F2cleU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <16efa53a-1919-42dc-9f24-4778c405f09bn@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: already5...@yahoo.com (Michael S)
Injection-Date: Tue, 04 Apr 2023 12:21:46 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2455
 by: Michael S - Tue, 4 Apr 2023 12:21 UTC

On Tuesday, April 4, 2023 at 12:18:32 PM UTC+3, Niklas Holsti wrote:
> On 2023-04-04 8:39, Anton Ertl wrote:
> > MitchAlsup <Mitch...@aol.com> writes:
> >> On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
> >>> https://queue.acm.org/detail.cfm?id=3D3588242=20
> [ snip ]
> > C11, C99, and C89 are not any better wrt. comparing pointers. If you
> > want a language that has a flat address space, use Forth.
> Or use Ada. While you can compare Ada pointers ("access values") only
> for equality, you can take the address of any object and compare
> addresses in any way you like (=, <, >, ...). You can also convert an
> address to a (dedicated predefined) integer type, do arithmetic on it,
> and then convert the result back to an address or a pointer.

Does Ada language guarantees persistence of address comparison?
I.e if address of object A is smaller than address of object B at one
one point in the program then the same holds for whole duration of the lifetime
of A and B?
If it's true it effectively disallows any form of GC that does memory compaction.

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<df2dd047-c753-4ae5-a761-af3a5355a9adn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31496&group=comp.arch#31496

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:4720:b0:733:4e2d:7834 with SMTP id bs32-20020a05620a472000b007334e2d7834mr982153qkb.4.1680612018910;
Tue, 04 Apr 2023 05:40:18 -0700 (PDT)
X-Received: by 2002:a9d:7387:0:b0:69e:aa7:6b71 with SMTP id
j7-20020a9d7387000000b0069e0aa76b71mr768000otk.3.1680612018606; Tue, 04 Apr
2023 05:40:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 4 Apr 2023 05:40:18 -0700 (PDT)
In-Reply-To: <16efa53a-1919-42dc-9f24-4778c405f09bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=199.203.251.52; posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 199.203.251.52
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<2023Apr4.073909@mips.complang.tuwien.ac.at> <k928b4F2cleU1@mid.individual.net>
<16efa53a-1919-42dc-9f24-4778c405f09bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <df2dd047-c753-4ae5-a761-af3a5355a9adn@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: already5...@yahoo.com (Michael S)
Injection-Date: Tue, 04 Apr 2023 12:40:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Michael S - Tue, 4 Apr 2023 12:40 UTC

On Tuesday, April 4, 2023 at 3:21:47 PM UTC+3, Michael S wrote:
> On Tuesday, April 4, 2023 at 12:18:32 PM UTC+3, Niklas Holsti wrote:
> > On 2023-04-04 8:39, Anton Ertl wrote:
> > > MitchAlsup <Mitch...@aol.com> writes:
> > >> On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
> > >>> https://queue.acm.org/detail.cfm?id=3D3588242=20
> > [ snip ]
> > > C11, C99, and C89 are not any better wrt. comparing pointers. If you
> > > want a language that has a flat address space, use Forth.
> > Or use Ada. While you can compare Ada pointers ("access values") only
> > for equality, you can take the address of any object and compare
> > addresses in any way you like (=, <, >, ...). You can also convert an
> > address to a (dedicated predefined) integer type, do arithmetic on it,
> > and then convert the result back to an address or a pointer.
> Does Ada language guarantees persistence of address comparison?
> I.e if address of object A is smaller than address of object B at one
> one point in the program then the same holds for whole duration of the lifetime
> of A and B?
> If it's true it effectively disallows any form of GC that does memory compaction.

Well, thinking about it, the statement above is incorrect.
Compaction without exchanging order of object in memory is perfectly possible.
Also, arbitrary compaction is possible if 'address of object'
returns address of object's descriptor which (descriptor) does not have
to be adjacent in memory to object's bulk.
Sometimes, before posting, I should remind to myself that there
is more than one way to skin a cat.

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<RNVWL.261611$Sgyc.143307@fx40.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31497&group=comp.arch#31497

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx40.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: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Newsgroups: comp.arch
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com> <rFHWL.168802$5jd8.43928@fx05.iad> <38460018-a033-41af-85a1-495e06670c19n@googlegroups.com>
Lines: 40
Message-ID: <RNVWL.261611$Sgyc.143307@fx40.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 04 Apr 2023 13:41:05 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 04 Apr 2023 13:41:05 GMT
X-Received-Bytes: 2278
 by: Scott Lurndal - Tue, 4 Apr 2023 13:41 UTC

MitchAlsup <MitchAlsup@aol.com> writes:
>On Monday, April 3, 2023 at 4:36:27=E2=80=AFPM UTC-5, Scott Lurndal wrote:
>> MitchAlsup <Mitch...@aol.com> writes:=20
>> >On Monday, April 3, 2023 at 1:39:14=3DE2=3D80=3DAFPM UTC-5, Terje Mathis=
>en wrote:=20
>> >> https://queue.acm.org/detail.cfm?id=3D3D3588242=3D20
>> ><=20
>> >In my 38 years of writing C code, I, personally, have never used realloc=
>()=20
>> >(or calloc() BTW).
>> Likewise, albeit in 43 years of C programming.
>> ><=20
>> >In all my future years of programming, I do not expect to compare pointe=
>rs.
>> Except when comparing them to the null pointer (NULL), which technically=
>=20
>> is 'comparing pointers' given the definition of NULL is usually (void *)0=
>.=20
><
>Yes, but when written::
><
> if( p ) { dereference( p ); }
>or
> if( !p ) { avoid_dereferencing( p ); }

I personally never use that style, reserving it
for boolean (particularly in C++) comparisons, I always
explicitly check for "== NULL".

><
>> Unfortunately, the Burroughs mainframes I programmed had an=20
>> odd segmentation scheme (designed to allow backward compatability=20
>> with 1,000,000 digit address space limits from the original early=20
>> 60's design, so pointers were rather tricky).
><
>Never programmed on one (except in algol60 which likely does not count ).

ALGOL was on the large systems family (48-bit, stack architecture). I
worked on the medium systems family (addressible to the digit, no
binary arithmetic).

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<gPVWL.261612$Sgyc.52791@fx40.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31498&group=comp.arch#31498

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx40.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: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Newsgroups: comp.arch
References: <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com> <u0f6gf$32irr$1@dont-email.me> <168057862503.27325.13559172660210279577@media.vsta.org>
Lines: 10
Message-ID: <gPVWL.261612$Sgyc.52791@fx40.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 04 Apr 2023 13:42:36 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 04 Apr 2023 13:42:36 GMT
X-Received-Bytes: 1146
 by: Scott Lurndal - Tue, 4 Apr 2023 13:42 UTC

Andy Valencia <vandys@vsta.org> writes:
>MitchAlsup <MitchAlsup@aol.com> writes:
>> In my 38 years of writing C code, I, personally, have never used realloc()
>> (or calloc() BTW).
>
>So if you have a list of, I don't know, int's, and you add one more to the
>list. What do you do instead of realloc() it to make room for another
>addition?

I have never needed to have a variable sized table of ints in 43 years of C programming.

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<k92r6iF2cleU2@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31499&group=comp.arch#31499

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Tue, 4 Apr 2023 17:40:18 +0300
Organization: Tidorum Ltd
Lines: 37
Message-ID: <k92r6iF2cleU2@mid.individual.net>
References: <u0f6gf$32irr$1@dont-email.me>
<a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<2023Apr4.073909@mips.complang.tuwien.ac.at>
<k928b4F2cleU1@mid.individual.net>
<16efa53a-1919-42dc-9f24-4778c405f09bn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net FaIv6YbTnELUyTAXGtFzdw8gbaDF23KDhna7mydxAwEIGn7T0E
Cancel-Lock: sha1:h6sJ7tG95d3IXd1I2AEaDCihZK8=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0)
Gecko/20100101 Thunderbird/102.6.1
Content-Language: en-US
In-Reply-To: <16efa53a-1919-42dc-9f24-4778c405f09bn@googlegroups.com>
 by: Niklas Holsti - Tue, 4 Apr 2023 14:40 UTC

On 2023-04-04 15:21, Michael S wrote:
> On Tuesday, April 4, 2023 at 12:18:32 PM UTC+3, Niklas Holsti wrote:
>> On 2023-04-04 8:39, Anton Ertl wrote:
>>> MitchAlsup <Mitch...@aol.com> writes:
>>>> On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
>>>>> https://queue.acm.org/detail.cfm?id=3D3588242=20
>> [ snip ]
>>> C11, C99, and C89 are not any better wrt. comparing pointers. If you
>>> want a language that has a flat address space, use Forth.
>> Or use Ada. While you can compare Ada pointers ("access values") only
>> for equality, you can take the address of any object and compare
>> addresses in any way you like (=, <, >, ...). You can also convert an
>> address to a (dedicated predefined) integer type, do arithmetic on it,
>> and then convert the result back to an address or a pointer.
>
> Does Ada language guarantees persistence of address comparison?
> I.e if address of object A is smaller than address of object B at one
> one point in the program then the same holds for whole duration of the lifetime
> of A and B?

Those are good questions that I don't remember ever seeing discussed for
Ada. I'll post a question on comp.lang.ada and report back.

> If it's true it effectively disallows any form of GC that does
> memory compaction.

I don't know of any current Ada programming system that provides garbage
collection based on pointer tracing. The defunct port of the GNAT Ada
compiler to the Java Virtual Machine surely did that, but I don't know
in what form and how it would affect this question. There are reports
that the Boehm conservative collector has been used successfully for Ada
programs, but it is not clear to me if that collector does compaction.
It is said to have generational collection, which I believe does usually
involve copying (moving) objects, and that would change addresses.

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<k92rmaF2cleU3@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31500&group=comp.arch#31500

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Tue, 4 Apr 2023 17:48:42 +0300
Organization: Tidorum Ltd
Lines: 42
Message-ID: <k92rmaF2cleU3@mid.individual.net>
References: <u0f6gf$32irr$1@dont-email.me>
<a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<2023Apr4.073909@mips.complang.tuwien.ac.at>
<k928b4F2cleU1@mid.individual.net>
<16efa53a-1919-42dc-9f24-4778c405f09bn@googlegroups.com>
<df2dd047-c753-4ae5-a761-af3a5355a9adn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net W9EWucSISFl8b3oH8ksBcwlGz9CNVe47RMFwFH000OIreSJlrb
Cancel-Lock: sha1:3ohPsXXrd37XRzYCs9/NkKHs2xc=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0)
Gecko/20100101 Thunderbird/102.6.1
Content-Language: en-US
In-Reply-To: <df2dd047-c753-4ae5-a761-af3a5355a9adn@googlegroups.com>
 by: Niklas Holsti - Tue, 4 Apr 2023 14:48 UTC

On 2023-04-04 15:40, Michael S wrote:
> On Tuesday, April 4, 2023 at 3:21:47 PM UTC+3, Michael S wrote:
>> On Tuesday, April 4, 2023 at 12:18:32 PM UTC+3, Niklas Holsti wrote:
>>> On 2023-04-04 8:39, Anton Ertl wrote:
>>>> MitchAlsup <Mitch...@aol.com> writes:
>>>>> On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
>>>>>> https://queue.acm.org/detail.cfm?id=3D3588242=20
>>> [ snip ]
>>>> C11, C99, and C89 are not any better wrt. comparing pointers. If you
>>>> want a language that has a flat address space, use Forth.
>>> Or use Ada. While you can compare Ada pointers ("access values") only
>>> for equality, you can take the address of any object and compare
>>> addresses in any way you like (=, <, >, ...). You can also convert an
>>> address to a (dedicated predefined) integer type, do arithmetic on it,
>>> and then convert the result back to an address or a pointer.
>> Does Ada language guarantees persistence of address comparison?
>> I.e if address of object A is smaller than address of object B at one
>> one point in the program then the same holds for whole duration of the lifetime
>> of A and B?
>> If it's true it effectively disallows any form of GC that does memory compaction.
>
> Well, thinking about it, the statement above is incorrect.
> Compaction without exchanging order of object in memory is perfectly possible.

Yes, but if you have generational collection that moves objects between
generations and sometimes swaps the generation spaces, it seems
impossible to preserve the order in all cases.

> Also, arbitrary compaction is possible if 'address of object'
> returns address of object's descriptor which (descriptor) does not have
> to be adjacent in memory to object's bulk.

Right, but as one can take the address of any element of an array --
A(I)'Address -- that would require separate descriptors for each
element, which is not very practical. In fact, the Ada standard strongly
recommends that the address of an array -- A'Address -- should equal the
address of the first array element -- A(A'First)'Address) rather than
the address of the "array descriptor" (if there is one).

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<642c4735$0$31534$426a34cc@news.free.fr>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31501&group=comp.arch#31501

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp1-1.free.fr!not-for-mail
From: jm...@bourguet.org (Jean-Marc Bourguet)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
References: <u0f6gf$32irr$1@dont-email.me>
<a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<2023Apr4.073909@mips.complang.tuwien.ac.at>
<k928b4F2cleU1@mid.individual.net>
<16efa53a-1919-42dc-9f24-4778c405f09bn@googlegroups.com>
<k92r6iF2cleU2@mid.individual.net>
Date: Tue, 04 Apr 2023 17:50:13 +0200
Cancel-Lock: sha1:2q24VVnOqqbpz9q5i22vbsBsNEk=
MIME-Version: 1.0
Content-Type: text/plain
Lines: 13
Message-ID: <642c4735$0$31534$426a34cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 04 Apr 2023 17:50:13 CEST
NNTP-Posting-Host: 88.121.147.132
X-Trace: 1680623413 news-4.free.fr 31534 88.121.147.132:49756
X-Complaints-To: abuse@proxad.net
 by: Jean-Marc Bourguet - Tue, 4 Apr 2023 15:50 UTC

Niklas Holsti <niklas.holsti@tidorum.invalid> writes:

> There are reports that the
> Boehm conservative collector has been used successfully for Ada programs,
> but it is not clear to me if that collector does compaction.

A conservative collector can't do compaction, it doesn't know for sure if a
bit pattern is a pointer or not.

Yours,

--
Jean-Marc

Re: C !!num idiom [was On the pitfalls of C and UB: C23 seems to be even worse. :-( ]

<FWXWL.109689$LAYb.45622@fx02.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31502&group=comp.arch#31502

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx02.iad.POSTED!not-for-mail
From: ThatWoul...@thevillage.com (EricP)
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version: 1.0
Newsgroups: comp.arch
Subject: Re: C !!num idiom [was On the pitfalls of C and UB: C23 seems to
be even worse. :-( ]
References: <u0f6gf$32irr$1@dont-email.me>
In-Reply-To: <u0f6gf$32irr$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 95
Message-ID: <FWXWL.109689$LAYb.45622@fx02.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Tue, 04 Apr 2023 16:07:01 UTC
Date: Tue, 04 Apr 2023 12:05:37 -0400
X-Received-Bytes: 3058
 by: EricP - Tue, 4 Apr 2023 16:05 UTC

Terje Mathisen wrote:
> https://queue.acm.org/detail.cfm?id=3588242
>
> Terje

I did not think the authors use of !!num idiom would produce optimal
code and was curious whether the optimizer would figure it out anyway
so I ran it through godbolt x86-64 gcc 12.2 -O3 (it did not)

// Authors version using !!num
typedef unsigned long Num_t;
Num_t Foo (Num_t ndogs, Num_t ncats, Num_t nfish)
{ Num_t petFee;

petFee =
!!ndogs * (10 + (ndogs-1) * 5)
+ !!ncats * ( 7 + (ncats-1) * 3)
+ !!nfish * (47 + (nfish-1) * 1);

return petFee;
}

// My no !!num version
Num_t Bar (Num_t ndogs, Num_t ncats, Num_t nfish)
{ Num_t petFee;

petFee =
(ndogs ? ndogs*5 + 5 : 0) +
(ncats ? ncats*3 + 4 : 0) +
(nfish ? nfish + 46 : 0);

return petFee;
}

# Compilation provided by Compiler Explorer at https://godbolt.org/
Foo(unsigned long, unsigned long, unsigned long):
xor ecx, ecx
test rsi, rsi
lea rax, [rsi+4+rsi*2]
setne cl
imul rax, rcx
xor ecx, ecx
test rdx, rdx
setne cl
add rdx, 46
imul rdx, rcx
xor ecx, ecx
add rax, rdx
test rdi, rdi
lea rdx, [rdi+1]
setne cl
imul rdx, rcx
lea rdx, [rdx+rdx*4]
add rax, rdx
ret

Bar(unsigned long, unsigned long, unsigned long):
mov rax, rdi
test rdi, rdi
je .L4
lea rax, [rdi+5+rdi*4]
..L4:
test rsi, rsi
je .L5
lea rcx, [rsi+4+rsi*2]
add rax, rcx
..L5:
lea rcx, [rax+46+rdx]
test rdx, rdx
cmovne rax, rcx
ret

I could not get gcc to generate a non-branching
version using CMOVs, for example:

// My non-branching version
Bar(unsigned long, unsigned long, unsigned long):
// ndogs: rdi ncats: rsi nfish: rdx
lea rax, [rdi+rdi*4+5]
test rdi, rdi
cmove rax, rdi // if rdi==0 we can use it to source 0
lea rcx, [rsi+rsi*2+4]
add rcx, rax
test rsi, rsi
cmovne rax, rcx
lea rcx, [rax+rdx+46]
test rdx, rdx
cmovne rax, rcx
ret

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<u0hlqh$3gf1v$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31503&group=comp.arch#31503

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Tue, 4 Apr 2023 12:12:46 -0500
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <u0hlqh$3gf1v$1@dont-email.me>
References: <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<u0f6gf$32irr$1@dont-email.me>
<168057862503.27325.13559172660210279577@media.vsta.org>
<gPVWL.261612$Sgyc.52791@fx40.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 4 Apr 2023 17:12:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8c0cfbe3c606a47c4dc61f1a32bbe340";
logging-data="3685439"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/BK4MyFUxZ3GbtpN5ntib3"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Cancel-Lock: sha1:Qx6SioMW67lPz/A8vlcstuRLwow=
Content-Language: en-US
In-Reply-To: <gPVWL.261612$Sgyc.52791@fx40.iad>
 by: BGB - Tue, 4 Apr 2023 17:12 UTC

On 4/4/2023 8:42 AM, Scott Lurndal wrote:
> Andy Valencia <vandys@vsta.org> writes:
>> MitchAlsup <MitchAlsup@aol.com> writes:
>>> In my 38 years of writing C code, I, personally, have never used realloc()
>>> (or calloc() BTW).
>>
>> So if you have a list of, I don't know, int's, and you add one more to the
>> list. What do you do instead of realloc() it to make room for another
>> addition?
>
> I have never needed to have a variable sized table of ints in 43 years of C programming.

Sometimes they are a better option than a linked list or tree structure...

So, I consider "realloc()" to be a reasonably useful feature.

I also consider relative comparison between arbitrary unrelated pointers
as a "this needs to work as usually expected" feature (comparison based
on address). Albeit in BGBCC with bounds-checks or similar enabled, this
does mean that internally the pointers need to have their tag bits
stripped off for the comparison to work correctly (though, could maybe
consider a "SUBA" instruction or similar, which subtracts two pointers
and also sign-extends over the tag bits as-if both pointers had their
tag bits set to zero).

....

In some contexts, a tree-like structure for arrays does have the
advantage that it can support creation and destruction of potentially
dynamically-sized arrays without leading to excessive memory
fragmentation, which is one potential downside of resizing things with
realloc.

Granted, in cases where I had used realloc() for dynamically sized
arrays, they had usually followed an "sz1=sz0+(sz0>>1);" pattern.

For some other contexts, I have used microfloats. Also my memory
managers often use microfloats for representing object sizes internally
(often E5.F3 or similar).

Albeit with the allocation strategy varying some based on object size, say:
Under 512B: Series of 16-byte cells managed by a bitmap;
512B..128K: Use variable-sized memory blocks within a larger region;
128K+: Use memory pages for the allocation.

....

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<IZYWL.1269187$gGD7.65877@fx11.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31504&group=comp.arch#31504

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx11.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: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Newsgroups: comp.arch
References: <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com> <u0f6gf$32irr$1@dont-email.me> <168057862503.27325.13559172660210279577@media.vsta.org> <gPVWL.261612$Sgyc.52791@fx40.iad> <u0hlqh$3gf1v$1@dont-email.me>
Lines: 31
Message-ID: <IZYWL.1269187$gGD7.65877@fx11.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 04 Apr 2023 17:18:32 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 04 Apr 2023 17:18:32 GMT
X-Received-Bytes: 2071
 by: Scott Lurndal - Tue, 4 Apr 2023 17:18 UTC

BGB <cr88192@gmail.com> writes:
>On 4/4/2023 8:42 AM, Scott Lurndal wrote:
>> Andy Valencia <vandys@vsta.org> writes:
>>> MitchAlsup <MitchAlsup@aol.com> writes:
>>>> In my 38 years of writing C code, I, personally, have never used realloc()
>>>> (or calloc() BTW).
>>>
>>> So if you have a list of, I don't know, int's, and you add one more to the
>>> list. What do you do instead of realloc() it to make room for another
>>> addition?
>>
>> I have never needed to have a variable sized table of ints in 43 years of C programming.
>
>Sometimes they are a better option than a linked list or tree structure...

Examples would be useful, other than academic exercises.

>
>So, I consider "realloc()" to be a reasonably useful feature.

It is used under-the-covers in C code generated by lex(1), I've noticed
(albeit wrapped by yyrealloc) when parsing.

>
>I also consider relative comparison between arbitrary unrelated pointers
>as a "this needs to work as usually expected" feature (comparison based
>on address).

Seems prone to error. If your pointers reference elements in a contiguous array, that's
one thing. If they're allocated via some allocator, that's a case prone to
fail eventually. Comparing for equality or NULL is the only nonproblematic usage.

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<b45943c0-511c-4059-914e-721d4ce9c6ean@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31505&group=comp.arch#31505

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:2994:b0:746:83cd:8d1d with SMTP id r20-20020a05620a299400b0074683cd8d1dmr164755qkp.6.1680628979622;
Tue, 04 Apr 2023 10:22:59 -0700 (PDT)
X-Received: by 2002:a05:6870:b613:b0:180:b597:c4fc with SMTP id
cm19-20020a056870b61300b00180b597c4fcmr1704688oab.6.1680628979308; Tue, 04
Apr 2023 10:22:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 4 Apr 2023 10:22:59 -0700 (PDT)
In-Reply-To: <168057862503.27325.13559172660210279577@media.vsta.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:ec4e:3a84:42:ed47;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:ec4e:3a84:42:ed47
References: <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<u0f6gf$32irr$1@dont-email.me> <168057862503.27325.13559172660210279577@media.vsta.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b45943c0-511c-4059-914e-721d4ce9c6ean@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Tue, 04 Apr 2023 17:22:59 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2042
 by: MitchAlsup - Tue, 4 Apr 2023 17:22 UTC

On Monday, April 3, 2023 at 10:24:41 PM UTC-5, Andy Valencia wrote:
> MitchAlsup <Mitch...@aol.com> writes:
> > In my 38 years of writing C code, I, personally, have never used realloc()
> > (or calloc() BTW).
> So if you have a list of, I don't know, int's, and you add one more to the
> list. What do you do instead of realloc() it to make room for another
> addition?
<
Malloc and linked lists.
<
I never use vectors of structs unless the length of the vector is fixed
at compile time. When unbounded or unknown, I use pointers lnked
lists.
>
> Andy Valencia
> Home page: https://www.vsta.org/andy/
> To contact me: https://www.vsta.org/contact/andy.html

Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(

<5e5e5490-38f3-49a8-b25e-341e02b754d2n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=31506&group=comp.arch#31506

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:191e:b0:746:7fc3:3b79 with SMTP id bj30-20020a05620a191e00b007467fc33b79mr22126qkb.5.1680629615928;
Tue, 04 Apr 2023 10:33:35 -0700 (PDT)
X-Received: by 2002:a05:6870:5586:b0:17f:d30c:6e62 with SMTP id
n6-20020a056870558600b0017fd30c6e62mr53453oao.0.1680629615670; Tue, 04 Apr
2023 10:33:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 4 Apr 2023 10:33:35 -0700 (PDT)
In-Reply-To: <2023Apr4.073909@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:ec4e:3a84:42:ed47;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:ec4e:3a84:42:ed47
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<2023Apr4.073909@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5e5e5490-38f3-49a8-b25e-341e02b754d2n@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Tue, 04 Apr 2023 17:33:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 6211
 by: MitchAlsup - Tue, 4 Apr 2023 17:33 UTC

On Tuesday, April 4, 2023 at 1:29:19 AM UTC-5, Anton Ertl wrote:
> MitchAlsup <Mitch...@aol.com> writes:
> >On Monday, April 3, 2023 at 1:39:14=E2=80=AFPM UTC-5, Terje Mathisen wrote:
> >> https://queue.acm.org/detail.cfm?id=3D3588242=20
> ><
> >In my 38 years of writing C code, I, personally, have never used realloc()
> >(or calloc() BTW).
> I have.
> >In all my future years of programming, I do not expect to compare pointers.
> >I haven't compared a pointer for the first 53 years of programming, why sta=
> >rt
> >now ?
>
> One reason for comparing pointers is if you want to implement
> memmove(), as discussed in the article.
<
Memmove() is free to implement pointer comparison, and I can use
memmove (but mainly I use struct assignment and let the compiler
figure it out.) But I did not write memmove(), but in my ISA there is
an MM instruction where HW does the pointer compares.
<
In my uses of memmove() it is structurally equal to memcpy().
>
> Another one (this one within standard-C confines) is walking through
> an array with an idiom like this:
>
> for (p=start; p<end; p++)
> ... *p ...
<
for( i = 0; i<max; i++ )
array[i] ...
<
I actually write array code that looks like array code.
>
> Another one was when unifying two free logic variables in a Prolog
> implementation. We do this by letting one logic variable point to the
> other, but which should point to which? The newer one should point to
> the older, because the newer one may be deallocated earlier. With
> stack allocation, we can find out by pointer comparison which one may
> be deallocated earlier. If the stack was a single object in standard
> C terms, this might be within its confines, but of course the Prolog
> implementation (like pretty much all other production programs)
> contained other things that have not been standardized in C, but which
> the compilers of the day used to compile as intended.
>
> In another case I needed an arbitrary total order of the objects (I
> don't remember for what purpose), and the addresses of the objects
> conveniently provided an order while the contents didn't. I remember
> that this was in a Forth program, and in standard Forth you can
> compare addresses.
<
Remember, I do not ever expect to use a machine where pointer
comparisons are tricky, nor do I even expect to create sell or give
away code that will be run on such a machine.
>
> >For the foreseeable future; I will not use machines that have tricky pointe> >rs.
> >The set of such machines are at least {x86-64, ARM, RISC-V, MIPS, VAX,
> >PDP-11, Nova, SPARC, IBM 360-3090, Mc 68K, Mc 88K, .....}
> I think you mean that these are machines that do not have tricky
> pointers.
>
> You do not mention IA-32. Is there any OS that exposes the potential
> tricky pointers of IA-32 to user-level code?
<
Not that I would be using.
>
> One interesting aspect of the way IA-32 was designed was that they had
> the segments as potentially overlapping extents in a 32-bit linear
> address space.
<
A poor feature that causes dame-branage.
>
> My current take would be to treat the segments like ASIDs, i.e.,
> extend the 32-bit address with 13 additional bits from the segment and
> have a paging system that maps these 45-bit addresses to physical
> memory; i.e., segments would be non-overlapping in this 45-bit address
> space (paging could result in several segments sharing pages, and a
> Unix would use this to implement, e.g., COW). This might have made it
> unnecessary to add the PCID later. I guess it would not have
> precluded PAE, unless they had catered for longer physical addresses
> from the start. I have not worked out the ramifications of this idea,
> so I might change my opinion once I have.
<
> >Can we face facts: The large flat linear address space model has won--
> >Just like Little Endian has won--and that comparing pointers in a large
> >flat linear address space is "easy" and there is no reason to make the
> >language "special" in this way. Better to make the non LFLAS models
> >pay the cost (are there any left?? If there are, why can't they continue=20
> >to use C11 ??)
>
> C11, C99, and C89 are not any better wrt. comparing pointers. If you
> want a language that has a flat address space, use Forth.
<
Yeah, lets see you write 8-wide BGOoO simulators in forth.
>
> - anton
> --
> 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
> Mitch Alsup, <c17fcd89-f024-40e7...@googlegroups.com>

Pages:123456789
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor