Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Oh, wait, that was Randal...nevermind... -- Larry Wall in <199709261754.KAA23761@wall.org>


devel / comp.arch / Re: 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
Re: The wonders of the PDP-8, On the pitfalls of C and UB: C23 seems to be even worse. :-(

<ade_L.417393$Ldj8.96542@fx47.iad>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx47.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: The wonders of the PDP-8, On the pitfalls of C and UB: C23 seems to be even worse. :-(
Newsgroups: comp.arch
References: <u14a94$2mo98$1@dont-email.me> <pcUZL.1534980$8_id.564295@fx09.iad> <u1an7t$3rrap$1@newsreader4.netcologne.de> <NSc_L.288248$ZhSc.250064@fx38.iad> <u1bqf3$2g9c$1@gal.iecc.com>
Lines: 36
Message-ID: <ade_L.417393$Ldj8.96542@fx47.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 14 Apr 2023 15:22:46 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 14 Apr 2023 15:22:46 GMT
X-Received-Bytes: 2602
 by: Scott Lurndal - Fri, 14 Apr 2023 15:22 UTC

John Levine <johnl@taugh.com> writes:
>According to Scott Lurndal <slp53@pacbell.net>:
>>>> Look - we ran timesharing on a 8kw PDP-8 with up to 8 active dialup users
>>>> doing program development (basic, focal, assembler) and playing
>>>> games. This was in the 1970's.
>>>
>>>That's impressive. There would have to be bank switching for the
>>>machine to be able to address more than 4096 words, I guess.
>>>
>>>How was task switching accomplished? By swapping out each user's
>>>process?
>>
>>Effectively, yes. Each user got a 4kw field. A maxed out
>>PDP-8 had 8 fields; but TSS8 supported as few as two, which
>>meant that there was one for the monitor and one for user
>>code. ...
>
>There were 3-bit instruction field and data field registers, with the
>data field used for the target of indirectly addressed memory
>reference instructions. In principle you could have a program running
>code in one field and data in others. I am not aware of anyone doing
>that, but just using it for the monitor in one field to manage user
>programs in another.
>
>The PDP-8 was an amazing design that manged to hit a sweet spot of
>being complete enough to do serious work and simple enough to
>implement using individual transistors in 1965 for under $20K. The
>versions that ran TSS-8 were larger and more complicated, but not that
>much larger and only a little more complicated.

The micro-operate instructions were clever; each bit was a different
operation, often complementary. For example, one of the micro operate
groups had a CMA (ones-complement the accumulator) and IAC (Increment accumulator);
setting both would negate a twos complement value; used for subtraction
since there was no subtract instruction, so to subtract, you would add
the twos-complement negated augend to the addend.

Re: The RISC killing fields (was: On the pitfalls of C ...)

<2023Apr14.174740@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: The RISC killing fields (was: On the pitfalls of C ...)
Date: Fri, 14 Apr 2023 15:47:40 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 36
Message-ID: <2023Apr14.174740@mips.complang.tuwien.ac.at>
References: <u17rcv$8d11$1@dont-email.me> <memo.20230413214030.10336F@jgd.cix.co.uk> <2023Apr13.232839@mips.complang.tuwien.ac.at> <_Vc_L.288283$ZhSc.282722@fx38.iad>
Injection-Info: dont-email.me; posting-host="409f3c8b10f5713a31f19163d5a20ed6";
logging-data="1697692"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18x3z/fP66eYBNRN5/jEYwn"
Cancel-Lock: sha1:QpTJrNzag2PkCGyu6aw1OXwTcIw=
X-newsreader: xrn 10.11
 by: Anton Ertl - Fri, 14 Apr 2023 15:47 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>>jgd@cix.co.uk (John Dallman) writes:
>>>MIPS belonged to SGI at the time. SGI believed in Itanium and halted MIPS
>>>development for several years. They realised in the end they were dead
>>>wrong, but were unable to catch up.
>>
>>It seems to me that they had trouble earlier. They just could not
>>compete in the GHz race like the others.
>
>I was there at the time. The R10k was as advanced as any competing
>CPU.

Yes, the R10K was fine. But after that, the others sped ahead, while
MIPS/SGI hardly advanced. According to
<https://en.wikipedia.org/wiki/R10000#R12000>, they cancelled a
project, and I remember news in this direction at the time, which is
what I meant with "trouble".

>It wasn't so much they believed in Itanium, rather at that
>time third party graphics for PC's were becoming competitive to
>SGI's bread-and-butter graphics workstations and the company
>was shifting towards the large origin systems. Itanium or
>an advanced version of the R14k were the choices and they
>chose the former (along with building an intel-based windows
>box).

Given the supercomputing-oriented nature of the Origins, the Itanium
may have provided ok performance. For a more general-purpose
workload, I wonder if an 800MHz R16000a was not faster than a 1GHz
Itanium II.

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

Re: The wonders of the PDP-8, On the pitfalls of C and UB: C23 seems to be even worse. :-(

<u1c1mt$2ckmj$1@news.xmission.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: legalize...@mail.xmission.com (Richard)
Newsgroups: comp.arch
Subject: Re: The wonders of the PDP-8, On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Fri, 14 Apr 2023 17:15:09 -0000 (UTC)
Organization: multi-cellular, biological
Sender: legalize+jeeves@mail.xmission.com
Message-ID: <u1c1mt$2ckmj$1@news.xmission.com>
References: <u14a94$2mo98$1@dont-email.me> <u1an7t$3rrap$1@newsreader4.netcologne.de> <NSc_L.288248$ZhSc.250064@fx38.iad> <u1bqf3$2g9c$1@gal.iecc.com>
Reply-To: (Richard) legalize+jeeves@mail.xmission.com
Injection-Date: Fri, 14 Apr 2023 17:15:09 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:2607:fa18:0:beef::4";
logging-data="2511571"; mail-complaints-to="abuse@xmission.com"
X-Reply-Etiquette: No copy by email, please
Mail-Copies-To: never
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: legalize@shell.xmission.com (Richard)
 by: Richard - Fri, 14 Apr 2023 17:15 UTC

[Please do not mail me a copy of your followup]

John Levine <johnl@taugh.com> spake the secret code
<u1bqf3$2g9c$1@gal.iecc.com> thusly:

>The PDP-8 was an amazing design that manged to hit a sweet spot of
>being complete enough to do serious work and simple enough to
>implement using individual transistors in 1965 for under $20K. The
>versions that ran TSS-8 were larger and more complicated, but not that
>much larger and only a little more complicated.

For those interested in the evolution of the implementation of PDP
architectures, this book is online and is a great read:

"Computer Engineering: A DEC iew of Hardware Systems Design"
C. Gordon Bell, J. Craig Mudge, John E. McNamara
<https://bitsavers.org/pdf/dec/_Books/Bell-ComputerEngineering.pdf>
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

Re: The wonders of the PDP-8, On the pitfalls of C and UB: C23 seems to be even worse. :-(

<u1ccaq$17j1$1@gal.iecc.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
From: joh...@taugh.com (John Levine)
Newsgroups: comp.arch
Subject: Re: The wonders of the PDP-8, On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Fri, 14 Apr 2023 20:16:26 -0000 (UTC)
Organization: Taughannock Networks
Message-ID: <u1ccaq$17j1$1@gal.iecc.com>
References: <u14a94$2mo98$1@dont-email.me> <NSc_L.288248$ZhSc.250064@fx38.iad> <u1bqf3$2g9c$1@gal.iecc.com> <u1c1mt$2ckmj$1@news.xmission.com>
Injection-Date: Fri, 14 Apr 2023 20:16:26 -0000 (UTC)
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
logging-data="40545"; mail-complaints-to="abuse@iecc.com"
In-Reply-To: <u14a94$2mo98$1@dont-email.me> <NSc_L.288248$ZhSc.250064@fx38.iad> <u1bqf3$2g9c$1@gal.iecc.com> <u1c1mt$2ckmj$1@news.xmission.com>
Cleverness: some
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: johnl@iecc.com (John Levine)
 by: John Levine - Fri, 14 Apr 2023 20:16 UTC

>>The PDP-8 was an amazing design that manged to hit a sweet spot of
>>being complete enough to do serious work and simple enough to
>>implement using individual transistors in 1965 for under $20K. The
>>versions that ran TSS-8 were larger and more complicated, but not that
>>much larger and only a little more complicated.
>
>For those interested in the evolution of the implementation of PDP
>architectures, this book is online and is a great read:
>
>"Computer Engineering: A DEC iew of Hardware Systems Design"
>C. Gordon Bell, J. Craig Mudge, John E. McNamara
><https://bitsavers.org/pdf/dec/_Books/Bell-ComputerEngineering.pdf>

Yup, I have my well worn paper copy right here. But I actually
programmed a PDP-8, from the switches among other ways, over 50
years ago.

--
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

Re: The wonders of the PDP-8, On the pitfalls of C and UB: C23 seems to be even worse. :-(

<cb168c4e-9a53-4eb6-9e16-3f397c39dc75n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:174b:b0:3e4:e076:c4a9 with SMTP id l11-20020a05622a174b00b003e4e076c4a9mr2287503qtk.10.1681504956208;
Fri, 14 Apr 2023 13:42:36 -0700 (PDT)
X-Received: by 2002:a05:6808:290:b0:38b:4fc0:40bf with SMTP id
z16-20020a056808029000b0038b4fc040bfmr1488372oic.0.1681504954853; Fri, 14 Apr
2023 13:42:34 -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: Fri, 14 Apr 2023 13:42:34 -0700 (PDT)
In-Reply-To: <u1ccaq$17j1$1@gal.iecc.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:2c03:e476:a8e8:458b;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:2c03:e476:a8e8:458b
References: <u14a94$2mo98$1@dont-email.me> <NSc_L.288248$ZhSc.250064@fx38.iad>
<u1bqf3$2g9c$1@gal.iecc.com> <u1c1mt$2ckmj$1@news.xmission.com> <u1ccaq$17j1$1@gal.iecc.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cb168c4e-9a53-4eb6-9e16-3f397c39dc75n@googlegroups.com>
Subject: Re: The wonders of the PDP-8, On the pitfalls of C and UB: C23 seems
to be even worse. :-(
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Fri, 14 Apr 2023 20:42:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2584
 by: MitchAlsup - Fri, 14 Apr 2023 20:42 UTC

On Friday, April 14, 2023 at 3:16:30 PM UTC-5, John Levine wrote:
> >>The PDP-8 was an amazing design that manged to hit a sweet spot of
> >>being complete enough to do serious work and simple enough to
> >>implement using individual transistors in 1965 for under $20K. The
> >>versions that ran TSS-8 were larger and more complicated, but not that
> >>much larger and only a little more complicated.
> >
> >For those interested in the evolution of the implementation of PDP
> >architectures, this book is online and is a great read:
> >
> >"Computer Engineering: A DEC iew of Hardware Systems Design"
> >C. Gordon Bell, J. Craig Mudge, John E. McNamara
> ><https://bitsavers.org/pdf/dec/_Books/Bell-ComputerEngineering.pdf>
> Yup, I have my well worn paper copy right here. But I actually
> programmed a PDP-8, from the switches among other ways, over 50
> years ago.
<
Mine was 51 years ago (1972) Science hall (now Scaife) extension
behind the 360/67 and aside the PDP-9.
> --
> Regards,
> John Levine, jo...@taugh.com, Primary Perpetrator of "The Internet for Dummies",
> Please consider the environment before reading this e-mail. https://jl.ly

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

<u1cg60$3sv5b$1@newsreader4.netcologne.de>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-d5b-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: Fri, 14 Apr 2023 21:22:08 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <u1cg60$3sv5b$1@newsreader4.netcologne.de>
References: <u15k4t$3oi33$2@newsreader4.netcologne.de>
<memo.20230413214829.10336H@jgd.cix.co.uk>
Injection-Date: Fri, 14 Apr 2023 21:22:08 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-d5b-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:d5b:0:7285:c2ff:fe6c:992d";
logging-data="4095147"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Fri, 14 Apr 2023 21:22 UTC

John Dallman <jgd@cix.co.uk> schrieb:
> In article <u15k4t$3oi33$2@newsreader4.netcologne.de>,
> tkoenig@netcologne.de (Thomas Koenig) wrote:
>
>> I don't understand the "VLAs are evil" attitude that some people
>> have. The low amount of stack available, especially for threads,
>> is a severe disadvantage for some systems; MacOS is particularly
>> evil in that respect. You can hardly run a decent pthreads (or
>> OMP-) based program there.
>
> The default thread stack sizes on macOS are pretty small. You have to set
> the thread stack sizes when you create the threads.

Hard to make a good choice when you're not running pthreads, but rather
implementing OpenMP via pthreads...

One of the things that would make sense to libgfortran is to add
reasonable behavior on stack overflow. There is also a PR about this.

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

<a518e028-e9f8-4f8f-9d54-209de2eee201n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:2512:b0:3e3:876e:d7dc with SMTP id cm18-20020a05622a251200b003e3876ed7dcmr3209632qtb.6.1681523776709;
Fri, 14 Apr 2023 18:56:16 -0700 (PDT)
X-Received: by 2002:a05:6808:486:b0:38c:d77:db1a with SMTP id
z6-20020a056808048600b0038c0d77db1amr1822938oid.3.1681523776438; Fri, 14 Apr
2023 18:56:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!peer03.ams4!peer.am4.highwinds-media.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: Fri, 14 Apr 2023 18:56:16 -0700 (PDT)
In-Reply-To: <u1cg60$3sv5b$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:2c03:e476:a8e8:458b;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:2c03:e476:a8e8:458b
References: <u15k4t$3oi33$2@newsreader4.netcologne.de> <memo.20230413214829.10336H@jgd.cix.co.uk>
<u1cg60$3sv5b$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a518e028-e9f8-4f8f-9d54-209de2eee201n@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Sat, 15 Apr 2023 01:56:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2560
 by: MitchAlsup - Sat, 15 Apr 2023 01:56 UTC

On Friday, April 14, 2023 at 4:22:12 PM UTC-5, Thomas Koenig wrote:
> John Dallman <j...@cix.co.uk> schrieb:
> > In article <u15k4t$3oi33$2...@newsreader4.netcologne.de>,
> > tko...@netcologne.de (Thomas Koenig) wrote:
> >
> >> I don't understand the "VLAs are evil" attitude that some people
> >> have. The low amount of stack available, especially for threads,
> >> is a severe disadvantage for some systems; MacOS is particularly
> >> evil in that respect. You can hardly run a decent pthreads (or
> >> OMP-) based program there.
> >
> > The default thread stack sizes on macOS are pretty small. You have to set
> > the thread stack sizes when you create the threads.
> Hard to make a good choice when you're not running pthreads, but rather
> implementing OpenMP via pthreads...
>
> One of the things that would make sense to libgfortran is to add
> reasonable behavior on stack overflow. There is also a PR about this.
<
A cactus stack, or move the stack to a more free area ?
<
Is this a problem with a 64-bit virtual address space ??
You can fit 4 billion 4GB stacks in a 64-bit VaS.

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

<dKy_L.1544231$8_id.417574@fx09.iad>

  copy mid

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

  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!fx09.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: On the pitfalls of C and UB: C23 seems to be even worse. :-(
References: <u15k4t$3oi33$2@newsreader4.netcologne.de> <memo.20230413214829.10336H@jgd.cix.co.uk> <u1cg60$3sv5b$1@newsreader4.netcologne.de> <a518e028-e9f8-4f8f-9d54-209de2eee201n@googlegroups.com>
In-Reply-To: <a518e028-e9f8-4f8f-9d54-209de2eee201n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 45
Message-ID: <dKy_L.1544231$8_id.417574@fx09.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Sat, 15 Apr 2023 14:43:21 UTC
Date: Sat, 15 Apr 2023 10:42:54 -0400
X-Received-Bytes: 2851
 by: EricP - Sat, 15 Apr 2023 14:42 UTC

MitchAlsup wrote:
> On Friday, April 14, 2023 at 4:22:12 PM UTC-5, Thomas Koenig wrote:
>> John Dallman <j...@cix.co.uk> schrieb:
>>> In article <u15k4t$3oi33$2...@newsreader4.netcologne.de>,
>>> tko...@netcologne.de (Thomas Koenig) wrote:
>>>
>>>> I don't understand the "VLAs are evil" attitude that some people
>>>> have. The low amount of stack available, especially for threads,
>>>> is a severe disadvantage for some systems; MacOS is particularly
>>>> evil in that respect. You can hardly run a decent pthreads (or
>>>> OMP-) based program there.
>>> The default thread stack sizes on macOS are pretty small. You have to set
>>> the thread stack sizes when you create the threads.
>> Hard to make a good choice when you're not running pthreads, but rather
>> implementing OpenMP via pthreads...
>>
>> One of the things that would make sense to libgfortran is to add
>> reasonable behavior on stack overflow. There is also a PR about this.
> <
> A cactus stack, or move the stack to a more free area ?
> <
> Is this a problem with a 64-bit virtual address space ??
> You can fit 4 billion 4GB stacks in a 64-bit VaS.

Move wouldn't work as the prior stack locations have references.

One could do stack chaining whereby a thread hops onto a new
stack allocation extent if it overflows the prior one.
There are some tricky bits, like if the overflow occurs
while constructing a new call frame, and exception stack
unwind handlers have to "do the right thing".

But yeah, with a 64 bit virtual space, or even the 48 bit subset,
4GB stacks is the simplest all around.

It requires the OS has memory sections which have both
reserved and committed ranges, as Windows does,
as you don't want to have to allocate the worst case amount
of resources for each stack. At startup the thread reserves
a 4GB stack address range but only commits a tiny fraction.
And all these stack limits need to be copied into the
user mode thread header so they can be quickly accessed.

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

<4iz_L.2076578$9sn9.920703@fx17.iad>

  copy mid

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

  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!fx17.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: <u15k4t$3oi33$2@newsreader4.netcologne.de> <memo.20230413214829.10336H@jgd.cix.co.uk> <u1cg60$3sv5b$1@newsreader4.netcologne.de> <a518e028-e9f8-4f8f-9d54-209de2eee201n@googlegroups.com> <dKy_L.1544231$8_id.417574@fx09.iad>
Lines: 61
Message-ID: <4iz_L.2076578$9sn9.920703@fx17.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 15 Apr 2023 15:21:36 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 15 Apr 2023 15:21:36 GMT
X-Received-Bytes: 3499
 by: Scott Lurndal - Sat, 15 Apr 2023 15:21 UTC

EricP <ThatWouldBeTelling@thevillage.com> writes:
>MitchAlsup wrote:
>> On Friday, April 14, 2023 at 4:22:12 PM UTC-5, Thomas Koenig wrote:
>>> John Dallman <j...@cix.co.uk> schrieb:
>>>> In article <u15k4t$3oi33$2...@newsreader4.netcologne.de>,
>>>> tko...@netcologne.de (Thomas Koenig) wrote:
>>>>
>>>>> I don't understand the "VLAs are evil" attitude that some people
>>>>> have. The low amount of stack available, especially for threads,
>>>>> is a severe disadvantage for some systems; MacOS is particularly
>>>>> evil in that respect. You can hardly run a decent pthreads (or
>>>>> OMP-) based program there.
>>>> The default thread stack sizes on macOS are pretty small. You have to set
>>>> the thread stack sizes when you create the threads.
>>> Hard to make a good choice when you're not running pthreads, but rather
>>> implementing OpenMP via pthreads...
>>>
>>> One of the things that would make sense to libgfortran is to add
>>> reasonable behavior on stack overflow. There is also a PR about this.
>> <
>> A cactus stack, or move the stack to a more free area ?
>> <
>> Is this a problem with a 64-bit virtual address space ??
>> You can fit 4 billion 4GB stacks in a 64-bit VaS.
>
>Move wouldn't work as the prior stack locations have references.
>
>One could do stack chaining whereby a thread hops onto a new
>stack allocation extent if it overflows the prior one.
>There are some tricky bits, like if the overflow occurs
>while constructing a new call frame, and exception stack
>unwind handlers have to "do the right thing".
>
>But yeah, with a 64 bit virtual space, or even the 48 bit subset,
>4GB stacks is the simplest all around.
>
>It requires the OS has memory sections which have both
>reserved and committed ranges, as Windows does,

With Posix systems (UNIX, Linux), each process has a
set of resource limits, which include the stack size
for the primary thread in the process. The kernel
will reserve that amount of space in the Virtual Address
space for the stack (plus not-present guard pages to
trap underflow or overflow).

A system call (setrlimit()) allows a process to alter the
limit, subject to system-wide hard limits (which generally
default to 'unlimited'). The shells have a ulimit command
that sets the resource limits for the shell, which are
inherited by any children, grandchildren, etc.

>as you don't want to have to allocate the worst case amount
>of resources for each stack.

Physical pages are allocated on demand, not preallocated.

For pthreads, the master thread can specify the stack size
for each subsequently created thread.

This capability dates back to 1989/1990 with SVR4.

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

<bdda285b-65e2-459a-97f3-29a49df0ef60n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:1a1e:b0:3e3:8a0e:495f with SMTP id f30-20020a05622a1a1e00b003e38a0e495fmr2945871qtb.13.1681572139618;
Sat, 15 Apr 2023 08:22:19 -0700 (PDT)
X-Received: by 2002:aca:f0b:0:b0:387:5a8c:4125 with SMTP id
11-20020aca0f0b000000b003875a8c4125mr1736208oip.3.1681572139241; Sat, 15 Apr
2023 08:22:19 -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: Sat, 15 Apr 2023 08:22:18 -0700 (PDT)
In-Reply-To: <u0qfbv$13nrd$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=80.62.117.231; posting-account=iwcJjQoAAAAIecwT8pOXxaSOyiUTZMJr
NNTP-Posting-Host: 80.62.117.231
References: <u0phn0$spgv$1@dont-email.me> <memo.20230407193508.10336r@jgd.cix.co.uk>
<u0qfbv$13nrd$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bdda285b-65e2-459a-97f3-29a49df0ef60n@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: peterfir...@gmail.com (Peter Lund)
Injection-Date: Sat, 15 Apr 2023 15:22:19 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3669
 by: Peter Lund - Sat, 15 Apr 2023 15:22 UTC

On Saturday, April 8, 2023 at 3:17:55 AM UTC+2, BGB wrote:
> I had noted (when targeting x86-64) that MSVC often seems to be a bit
> faster.
>
> Build times for a program (ROTT):
> GCC: 17.06 seconds
> MSVC: 4.76 seconds
> BGBCC: 31.30 seconds
>
> So, BGBCC is apparently the slowest of this group at present...

You should really try a few things:
1) WSL2
2) on a native ext4 filesystem
3) with all the non-native directories removed from your PATH

Windows is notoriously slow at files and directories... and gcc/clang open lots of files (or try to) behind the scenes.

Don't upgrade to Windows 11 unless you are certain your CPU is supported. You can perform various kinds of magic to upgrade to Win 11 anyway but it's not worth it these days.

There was a period where it was, due to sorely needed WSL2 features being in Win 11 and not Win 10. For a while they were only in in prerelease versions of Win 11...

4) winget works ok now.
5) Windows Terminal is pretty good now.
6) VS Code is pretty good (also for working with files in a container or inside a WSL2 system). It also has a decent built-in terminal + debugger. They also work for WSL2.
7) you should upgrade to something like Ubuntu 22.04LTS (cat /etc/lsb-release to see your current version)
That gives you gcc-12 and clang-15.
8) X Just Works (almost -- there are a few minor glitches here and there). You don't need to run Xming.
9) perf can be made to work, mostly...
performance counters are virtualized now (at least on the Win 11 I'm running).
The hard part is to find/install a perf that works with the kernel version.
perf doesn't work as well as it would on a true Linux install -- there are some events that aren't available + you can't sample as fast as you can on a real machine.
Still, perf alone is worth spending some time fiddling with upgrades...
10) virtualization -- WSL2 requires enabling some sort of virtualization which conflicts with apps that don't yet use the new(ish) API for virtualization.
VirtualBox 6.x, for example. Microsoft's Hyper-V works fine (but I don't like the GUI). The new VirtualBox 7.0 also works fine.

Worth looking into, I think. You will get faster compiles, faster file I/O, newer compilers, nicer X, nicer VS Code, and perf!

-Peter

PS: perhaps worth reading:
https://devblogs.microsoft.com/commandline/

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

<d23cb76f-4252-488c-95f2-f2ecc3933b29n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:6214:176d:b0:5ef:528d:8899 with SMTP id et13-20020a056214176d00b005ef528d8899mr990386qvb.4.1681573333041;
Sat, 15 Apr 2023 08:42:13 -0700 (PDT)
X-Received: by 2002:a05:6870:5897:b0:186:c7c:b98e with SMTP id
be23-20020a056870589700b001860c7cb98emr4633754oab.0.1681573332702; Sat, 15
Apr 2023 08:42:12 -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: Sat, 15 Apr 2023 08:42:12 -0700 (PDT)
In-Reply-To: <u0f6gf$32irr$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=80.62.117.231; posting-account=iwcJjQoAAAAIecwT8pOXxaSOyiUTZMJr
NNTP-Posting-Host: 80.62.117.231
References: <u0f6gf$32irr$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d23cb76f-4252-488c-95f2-f2ecc3933b29n@googlegroups.com>
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
From: peterfir...@gmail.com (Peter Lund)
Injection-Date: Sat, 15 Apr 2023 15:42:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Peter Lund - Sat, 15 Apr 2023 15:42 UTC

On Monday, April 3, 2023 at 8:39:14 PM UTC+2, Terje Mathisen wrote:
> 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"

The author doesn't quite seem to have understood the topic...

unreachable() is a good thing:

#ifdef NDEBUG
# define ASSERT(x) do { if (!x) unreachable(); } while(0)
#else
# define ASSERT(x) assert(x)
#endif

We can use it to tell the compiler about things that definitely aren't going to be true (we hope), which often leads to better code.
(There is prior art in the form of __builtin_unreachable() in gcc/clang and __assume(0) in msvc.)

bool/true/false/etc are not going to become keywords. They are going to become predefined macros -- so it is going to be easy to work with legacy code.

You in particular should really like _BitInt(n) and #embed and constexpr and '= {}'!

The only real issue is realloc(p, 0) which some people apparently liked. The example code is pretty crappy because it does far too much resizing. At least do doubling/halving! However, it turns out to be implementation-defined behaviour -- and implementations really did differ. I think C23 does the right thing here by closing that hole.

https://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2464.pdf

This blog by JeanHeyd Meneide is a wonderful source for C standards info -- he is the editor of the C23 standard:

https://thephd.dev/

In my opinion, C23 looks like a huge step forward :)

-Peter

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

<u1eu3n$259vi$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: terje.ma...@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Sat, 15 Apr 2023 21:32:04 +0200
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <u1eu3n$259vi$1@dont-email.me>
References: <u0f6gf$32irr$1@dont-email.me>
<d23cb76f-4252-488c-95f2-f2ecc3933b29n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 15 Apr 2023 19:32:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1bdaefa2550b9b581c41c87ca227ade5";
logging-data="2271218"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/I3BPWCc7lmrOOcxBcUfEukfM5ZYymWF183IksNMe9Bw=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:t2hs4PMyl+LLSk6MWPU3H8Wem/M=
In-Reply-To: <d23cb76f-4252-488c-95f2-f2ecc3933b29n@googlegroups.com>
 by: Terje Mathisen - Sat, 15 Apr 2023 19:32 UTC

Thanks Peter!

I can easily live with the realloc change, seeing that I have done
approximately 0 realloc() calls in my entire programming lifetime.

Terje

Peter Lund wrote:
> On Monday, April 3, 2023 at 8:39:14 PM UTC+2, Terje Mathisen wrote:
>> 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"
>
> The author doesn't quite seem to have understood the topic...
>
> unreachable() is a good thing:
>
> #ifdef NDEBUG
> # define ASSERT(x) do { if (!x) unreachable(); } while(0)
> #else
> # define ASSERT(x) assert(x)
> #endif
>
> We can use it to tell the compiler about things that definitely aren't going to be true (we hope), which often leads to better code.
> (There is prior art in the form of __builtin_unreachable() in gcc/clang and __assume(0) in msvc.)
>
>
> bool/true/false/etc are not going to become keywords. They are going to become predefined macros -- so it is going to be easy to work with legacy code.
>
> You in particular should really like _BitInt(n) and #embed and constexpr and '= {}'!
>
> The only real issue is realloc(p, 0) which some people apparently liked. The example code is pretty crappy because it does far too much resizing. At least do doubling/halving! However, it turns out to be implementation-defined behaviour -- and implementations really did differ. I think C23 does the right thing here by closing that hole.
>
> https://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400
>
> https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2464.pdf
>
> This blog by JeanHeyd Meneide is a wonderful source for C standards info -- he is the editor of the C23 standard:
>
> https://thephd.dev/
>
> In my opinion, C23 looks like a huge step forward :)
>
> -Peter
>

--
- <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. :-(

<XCA_L.338640$Olad.245623@fx35.iad>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!peer01.ams4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx35.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: On the pitfalls of C and UB: C23 seems to be even worse. :-(
References: <u15k4t$3oi33$2@newsreader4.netcologne.de> <memo.20230413214829.10336H@jgd.cix.co.uk> <u1cg60$3sv5b$1@newsreader4.netcologne.de> <a518e028-e9f8-4f8f-9d54-209de2eee201n@googlegroups.com> <dKy_L.1544231$8_id.417574@fx09.iad> <4iz_L.2076578$9sn9.920703@fx17.iad>
In-Reply-To: <4iz_L.2076578$9sn9.920703@fx17.iad>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 69
Message-ID: <XCA_L.338640$Olad.245623@fx35.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Sat, 15 Apr 2023 16:52:07 UTC
Date: Sat, 15 Apr 2023 12:51:37 -0400
X-Received-Bytes: 4128
 by: EricP - Sat, 15 Apr 2023 16:51 UTC

Scott Lurndal wrote:
> EricP <ThatWouldBeTelling@thevillage.com> writes:
>> MitchAlsup wrote:
>>> On Friday, April 14, 2023 at 4:22:12 PM UTC-5, Thomas Koenig wrote:
>>>> John Dallman <j...@cix.co.uk> schrieb:
>>>>> In article <u15k4t$3oi33$2...@newsreader4.netcologne.de>,
>>>>> tko...@netcologne.de (Thomas Koenig) wrote:
>>>>>
>>>>>> I don't understand the "VLAs are evil" attitude that some people
>>>>>> have. The low amount of stack available, especially for threads,
>>>>>> is a severe disadvantage for some systems; MacOS is particularly
>>>>>> evil in that respect. You can hardly run a decent pthreads (or
>>>>>> OMP-) based program there.
>>>>> The default thread stack sizes on macOS are pretty small. You have to set
>>>>> the thread stack sizes when you create the threads.
>>>> Hard to make a good choice when you're not running pthreads, but rather
>>>> implementing OpenMP via pthreads...
>>>>
>>>> One of the things that would make sense to libgfortran is to add
>>>> reasonable behavior on stack overflow. There is also a PR about this.
>>> <
>>> A cactus stack, or move the stack to a more free area ?
>>> <
>>> Is this a problem with a 64-bit virtual address space ??
>>> You can fit 4 billion 4GB stacks in a 64-bit VaS.
>> Move wouldn't work as the prior stack locations have references.
>>
>> One could do stack chaining whereby a thread hops onto a new
>> stack allocation extent if it overflows the prior one.
>> There are some tricky bits, like if the overflow occurs
>> while constructing a new call frame, and exception stack
>> unwind handlers have to "do the right thing".
>>
>> But yeah, with a 64 bit virtual space, or even the 48 bit subset,
>> 4GB stacks is the simplest all around.
>>
>> It requires the OS has memory sections which have both
>> reserved and committed ranges, as Windows does,
>
> With Posix systems (UNIX, Linux), each process has a
> set of resource limits, which include the stack size
> for the primary thread in the process. The kernel
> will reserve that amount of space in the Virtual Address
> space for the stack (plus not-present guard pages to
> trap underflow or overflow).
>
> A system call (setrlimit()) allows a process to alter the
> limit, subject to system-wide hard limits (which generally
> default to 'unlimited'). The shells have a ulimit command
> that sets the resource limits for the shell, which are
> inherited by any children, grandchildren, etc.
>
>> as you don't want to have to allocate the worst case amount
>> of resources for each stack.
>
> Physical pages are allocated on demand, not preallocated.

Right but certain resource availability should be checked
when an address range changes from reserve to commit.
E.g. we don't want to reserve page file space based on the
memory section reserve ranges but do so for the commit range.
There may be other such resources reserved or allocated
based on section commit range.

> For pthreads, the master thread can specify the stack size
> for each subsequently created thread.
>
> This capability dates back to 1989/1990 with SVR4.

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

<_hB_L.2326766$vBI8.833539@fx15.iad>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!peer02.ams4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.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: <u15k4t$3oi33$2@newsreader4.netcologne.de> <memo.20230413214829.10336H@jgd.cix.co.uk> <u1cg60$3sv5b$1@newsreader4.netcologne.de> <a518e028-e9f8-4f8f-9d54-209de2eee201n@googlegroups.com> <dKy_L.1544231$8_id.417574@fx09.iad> <4iz_L.2076578$9sn9.920703@fx17.iad> <XCA_L.338640$Olad.245623@fx35.iad>
Lines: 35
Message-ID: <_hB_L.2326766$vBI8.833539@fx15.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 15 Apr 2023 17:38:02 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 15 Apr 2023 17:38:02 GMT
X-Received-Bytes: 2301
 by: Scott Lurndal - Sat, 15 Apr 2023 17:38 UTC

EricP <ThatWouldBeTelling@thevillage.com> writes:
>Scott Lurndal wrote:
>> EricP <ThatWouldBeTelling@thevillage.com> writes:

>>
>> A system call (setrlimit()) allows a process to alter the
>> limit, subject to system-wide hard limits (which generally
>> default to 'unlimited'). The shells have a ulimit command
>> that sets the resource limits for the shell, which are
>> inherited by any children, grandchildren, etc.
>>
>>> as you don't want to have to allocate the worst case amount
>>> of resources for each stack.
>>
>> Physical pages are allocated on demand, not preallocated.
>
>Right but certain resource availability should be checked
>when an address range changes from reserve to commit.
>E.g. we don't want to reserve page file space based on the
>memory section reserve ranges but do so for the commit range.
>There may be other such resources reserved or allocated
>based on section commit range.

That depends. Some operating systems (AIX, if I recall
correctly, and Linux if configured) will overcommit memory
and produce a fault (SIGSEGV/SIGBUS) via the OOM killer
if a physical pageisn't available. This allows for large sparse
virtual address spaces.

On my system, I allow moderate overcommit:

$ cat /proc/sys/vm/overcommit_memory
0

Setting that variable to '2' will disable overcommit.

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

<ru8ywD.14H2@kithrup.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!news-vm.kithrup.com!kithrup.com!mrs
From: mrs...@kithrup.com (Mike Stump)
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Message-ID: <ru8ywD.14H2@kithrup.com>
Date: Sat, 6 May 2023 17:21:49 GMT
References: <u0f6gf$32irr$1@dont-email.me> <2023Apr10.143646@mips.complang.tuwien.ac.at> <u118f4$27ckk$1@dont-email.me> <2023Apr10.175439@mips.complang.tuwien.ac.at>
Organization: Kithrup Enterprises, Ltd.
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
 by: Mike Stump - Sat, 6 May 2023 17:21 UTC

In article <2023Apr10.175439@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>David Brown <david.brown@hesbynett.no> writes:
>>On 10/04/2023 14:36, Anton Ertl wrote:
>>> David Brown <david.brown@hesbynett.no> writes:
>>>> On 04/04/2023 07:39, Anton Ertl wrote:
>[...]
>>#include <string.h>
>>
>>void * my_memmove(void * s1, const void * s2, size_t n) {
>> return memmove(s1, s2, n);
>>}
>>
>>There. Finished.
>
>Well done. Next:

:-)

>vadd(double *a, double *b, double c, size_t n)
>{
>/* write the equivalent of the Fortran a(1:n)=b(1:n)+c; note that the
> parameters are passed according to C rules, so a and b may or may
> not be pointers into the same array */
>}
>
>>As with any language, there are always things
>>that people would like to do in the language, but can't - the
>>alternative is that people will complain that the language (and/or
>>standard library) is too big.
>
>C already includes pointer comparison. Making it undefined for
>certain cases increases the things a programmer has to remember in
>order to use C, i.e., the language the programmer experiences becomes
>bigger.
>
>>(See C++ for evidence of that!)
>
>Does C++ define pointer comparison? I don't think so.

Why would you think that? Yes, it is unspecified and that is how we
read C and we saw the utility of doing better with the wording.

But, that is enough as one can then reliably do the pointer
comparisons necessary to ensure the memmove can be written, cleanly
and directly.

The entire point about C is a bit silly, only a hater of C could worry
about it as there are no implementations anywhere that anyone uses
that have a C compiler in which it would have given them a hard time
over this point. True today, true tomorrow, true for all future C
language standards, true for all future implementations that run C.

Only a historian with deep knowledge of the sins of the past might be
able to name an implementation for which there was ever any
complexity. Such a system might have once been rumored to exist, but
even the rumors fade with time.

Now, you willl come back that a person is free to create something
that claims to be C that breaks pointer comparisons, this is true, but
as irrelevant as that implementation.

But, I do agree with you. C should have always precisely and exactly
defined this in the language standard. They continue to fail us by
not improving the theoretic deficiency in the standard. But, as a
practicle matter, their failing is irrelevant, no one cares and it
doesn't matter to anyone. The standard should be read as the C++
language standard is read, at a minimum.

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

<864jlyz93n.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Thu, 20 Jul 2023 12:17:00 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <864jlyz93n.fsf@linuxsc.com>
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com> <2023Apr4.073909@mips.complang.tuwien.ac.at> <u10pbe$259vd$1@dont-email.me> <2023Apr10.143646@mips.complang.tuwien.ac.at> <68VYL.2039083$9sn9.730653@fx17.iad> <2023Apr10.164359@mips.complang.tuwien.ac.at> <KwVYL.1294624$gGD7.576331@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="3857442d865f8a7bff3454fde02b814b";
logging-data="2993568"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xDrbxm7Mlc2J+betUqmIHdwRomDyQRP4="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:sVTfaZYdKYfAJUPq4MTaKptt6Nw=
sha1:yehALb4UdqgR1xjk7P3EOJMjAjA=
 by: Tim Rentsch - Thu, 20 Jul 2023 19:17 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

[...]

> An array object that encompasses the entire virtual address space
> is easily defined on modern (nonsegmented) processors, in which case
> ptrdiff_t is defined for subtraction of any two virtual addresses.

The ISO C standard does not make that guarantee. A value of
type ptrdiff_t must be at least 17 bits, including the sign
bit. If subtraction of two pointers gives a value outside
the range of ptrdiff_t, the behavior is undefined.

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

<86zg3qxugk.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Thu, 20 Jul 2023 12:18:35 -0700
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <86zg3qxugk.fsf@linuxsc.com>
References: <u14a94$2mo98$1@dont-email.me> <memo.20230412231342.10336D@jgd.cix.co.uk> <u17rcv$8d11$1@dont-email.me> <pcUZL.1534980$8_id.564295@fx09.iad> <u19cv4$12isu$1@dont-email.me> <ysXZL.241636$b7Kc.58548@fx39.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="3857442d865f8a7bff3454fde02b814b";
logging-data="2993568"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18IV8bDqUq3/qhrdxVsxb/G7ufjLJ95KvQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:9x3iBUd1pnNfH0Xfbrvr1iHsYeA=
sha1:YiBxvjpWdexA4TIFrCZOvjBW8SM=
 by: Tim Rentsch - Thu, 20 Jul 2023 19:18 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

> Intel 4004 in 1971 was the first microprocessor.

Actually the first microprocessor was done in the
late 1960s, for military hardware (fighter jets IIRC)
but was classified until recently.

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

<86ilaexnet.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Thu, 20 Jul 2023 14:50:50 -0700
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <86ilaexnet.fsf@linuxsc.com>
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com> <2023Apr4.073909@mips.complang.tuwien.ac.at> <u10pbe$259vd$1@dont-email.me> <u1132k$26kkr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="3857442d865f8a7bff3454fde02b814b";
logging-data="3042472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eA40YixFHOhEtozhmw57H5/ltak+cgbE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:UgznH4/tjwXjvPUlaDxCCw7H5EA=
sha1:PeOATrQRdjIhS+DiE9XeyN8cPsU=
 by: Tim Rentsch - Thu, 20 Jul 2023 21:50 UTC

Terje Mathisen <terje.mathisen@tmsw.no> writes:

> David Brown wrote:
>
>> On 04/04/2023 07:39, Anton Ertl wrote:
>>
>>> One reason for comparing pointers is if you want to implement
>>> memmove(), as discussed in the article.
>>
>> memmove(), and other standard library functions, are part of the
>> implementation. They were traditionally implemented in assembly,
>> and only later in C. But as part of the implementation, they can
>> use features that are implementation-specific - there was never any
>> need or intention that such functions should be implementable in
>> portable standards-compliant C. The language never had any need to
>> support writing an efficient memmove() in C - it gave you a
>> ready-made memmove() function so that implementing it yourself is
>> not necessary.
>
> Is pointer comparison implementation defined (ID) or UB?

Any two pointers (including null pointers) may be compared for
equality or inequality. The result is well defined: either
they are the same, or they aren't, and the implementation has
nothing to say about it.

For relational comparisons, the two pointers must be pointers into
(or one past) the same array object. All other pointer pairs
(including either or both being a null pointer) fall into UB
if relationally compared.

> If it is ID, then I can write my own version of memmove() (or similar
> ops) on any given compiler, as long as I do it the way that particular
> compiler have defined it, right?
>
> If it is UB, then that's impossible, you have to step outside of the C
> standard to implement it, and do so in a way that makes it impossible
> for the compiler to discover that you have done so. :-)

This conclusion is wrong. It is possible to implement memmove() in
standard C using only well-defined comparisons. (I suppose I should
add that some people would object based on the belief that the means
of doing so is horrible, which I don't necessarily share, but either
way I still think it's worth pointing out that it's possible, and
even feasible.)

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

<u9cc4t$2t51r$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: devz...@nospam.com (chrisq)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Thu, 20 Jul 2023 22:23:25 +0000
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <u9cc4t$2t51r$1@dont-email.me>
References: <u14a94$2mo98$1@dont-email.me>
<memo.20230412231342.10336D@jgd.cix.co.uk> <u17rcv$8d11$1@dont-email.me>
<pcUZL.1534980$8_id.564295@fx09.iad> <u19cv4$12isu$1@dont-email.me>
<ysXZL.241636$b7Kc.58548@fx39.iad> <86zg3qxugk.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 20 Jul 2023 22:23:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="fabc0a67654ff25cd7b0b1a12db3ee86";
logging-data="3052603"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//p19WPC2bCOnWCbkNYgxp"
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101
Thunderbird/102.11.2
Cancel-Lock: sha1:gYU+n1ZubCXrOsvsHaVekYe4770=
Content-Language: en-US
In-Reply-To: <86zg3qxugk.fsf@linuxsc.com>
 by: chrisq - Thu, 20 Jul 2023 22:23 UTC

On 7/20/23 19:18, Tim Rentsch wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>
>> Intel 4004 in 1971 was the first microprocessor.
>
> Actually the first microprocessor was done in the
> late 1960s, for military hardware (fighter jets IIRC)
> but was classified until recently.

Once owned a Honeywell mainframe terminal, poll / select type, that
had a set of 40 pin packages by Fairchild, called the "Basic Logic
Unit". Perhaps a for runner of the F8 series, but never found
anymore info on the set at the time. Date code 1969, but the earliest
Intel efforts were not single chip designs, and this preceded such by
quite wide margin...

Chris

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

<u9ccv0$2t51r$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: devz...@nospam.com (chrisq)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Thu, 20 Jul 2023 22:37:20 +0000
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <u9ccv0$2t51r$2@dont-email.me>
References: <u0f6gf$32irr$1@dont-email.me>
<a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com>
<2023Apr4.073909@mips.complang.tuwien.ac.at> <u10pbe$259vd$1@dont-email.me>
<u1132k$26kkr$1@dont-email.me> <86ilaexnet.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 20 Jul 2023 22:37:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="fabc0a67654ff25cd7b0b1a12db3ee86";
logging-data="3052603"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19I6h361dhW7qiZKlZ2oaVV"
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101
Thunderbird/102.11.2
Cancel-Lock: sha1:4g64Vdran7OS2vxYjxcCexndPts=
In-Reply-To: <86ilaexnet.fsf@linuxsc.com>
Content-Language: en-US
 by: chrisq - Thu, 20 Jul 2023 22:37 UTC

On 7/20/23 21:50, Tim Rentsch wrote:
> Terje Mathisen <terje.mathisen@tmsw.no> writes:
>
>> David Brown wrote:
>>
>>> On 04/04/2023 07:39, Anton Ertl wrote:
>>>
>>>> One reason for comparing pointers is if you want to implement
>>>> memmove(), as discussed in the article.
>>>
>>> memmove(), and other standard library functions, are part of the
>>> implementation. They were traditionally implemented in assembly,
>>> and only later in C. But as part of the implementation, they can
>>> use features that are implementation-specific - there was never any
>>> need or intention that such functions should be implementable in
>>> portable standards-compliant C. The language never had any need to
>>> support writing an efficient memmove() in C - it gave you a
>>> ready-made memmove() function so that implementing it yourself is
>>> not necessary.
>>
>> Is pointer comparison implementation defined (ID) or UB?
>
> Any two pointers (including null pointers) may be compared for
> equality or inequality. The result is well defined: either
> they are the same, or they aren't, and the implementation has
> nothing to say about it.
>
> For relational comparisons, the two pointers must be pointers into
> (or one past) the same array object. All other pointer pairs
> (including either or both being a null pointer) fall into UB
> if relationally compared.
>
>> If it is ID, then I can write my own version of memmove() (or similar
>> ops) on any given compiler, as long as I do it the way that particular
>> compiler have defined it, right?
>>
>> If it is UB, then that's impossible, you have to step outside of the C
>> standard to implement it, and do so in a way that makes it impossible
>> for the compiler to discover that you have done so. :-)
>
> This conclusion is wrong. It is possible to implement memmove() in
> standard C using only well-defined comparisons. (I suppose I should
> add that some people would object based on the belief that the means
> of doing so is horrible, which I don't necessarily share, but either
> way I still think it's worth pointing out that it's possible, and
> even feasible.)

Programming in C or speaking natural language is fundamentally
about communication. If you want to be sure that the receiver
understands what you are saying, speak clearly and make no
assumptions about the receiver's knowledge.

Always program a strict subset of C here, no clever stuff
and most of it works first time, apart from typos. Saves
so much time in the long run. Can't be bothered doing
it right to start is the reason why we have so much bad code
to put up with...

Chris

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

<86o7k6w61y.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Thu, 20 Jul 2023 15:51:05 -0700
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <86o7k6w61y.fsf@linuxsc.com>
References: <u0f6gf$32irr$1@dont-email.me> <d23cb76f-4252-488c-95f2-f2ecc3933b29n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="2d78163bfb891e7187c96a580a5a5784";
logging-data="3062304"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19T2ZNtHcbnoWcKuKyXkVXJHBmXOIb3E8w="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:7bieKWwGWfL62suV2V207genGno=
sha1:8Psc0yJOBL3YhBRgx/Koy6HvKds=
 by: Tim Rentsch - Thu, 20 Jul 2023 22:51 UTC

Peter Lund <peterfirefly@gmail.com> writes:

> bool/true/false/etc are not going to become keywords.

In C23 they are.

> In my opinion, C23 looks like a huge step forward :)

I have no argument about it being a huge step. Which
direction the step is going is another matter.

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

<kdwuM.10045$O8ab.7764@fx40.iad>

  copy mid

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

  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!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> <2023Apr4.073909@mips.complang.tuwien.ac.at> <u10pbe$259vd$1@dont-email.me> <2023Apr10.143646@mips.complang.tuwien.ac.at> <68VYL.2039083$9sn9.730653@fx17.iad> <2023Apr10.164359@mips.complang.tuwien.ac.at> <KwVYL.1294624$gGD7.576331@fx11.iad> <864jlyz93n.fsf@linuxsc.com>
Lines: 14
Message-ID: <kdwuM.10045$O8ab.7764@fx40.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 21 Jul 2023 14:01:52 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 21 Jul 2023 14:01:52 GMT
X-Received-Bytes: 1353
 by: Scott Lurndal - Fri, 21 Jul 2023 14:01 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>scott@slp53.sl.home (Scott Lurndal) writes:
>
>[...]
>
>> An array object that encompasses the entire virtual address space
>> is easily defined on modern (nonsegmented) processors, in which case
>> ptrdiff_t is defined for subtraction of any two virtual addresses.
>
>The ISO C standard does not make that guarantee.

I never made such a claim. This isn't comp.lang.c

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

<86y1j8t4r2.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Sat, 22 Jul 2023 07:12:01 -0700
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <86y1j8t4r2.fsf@linuxsc.com>
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com> <2023Apr4.073909@mips.complang.tuwien.ac.at> <u10pbe$259vd$1@dont-email.me> <2023Apr10.143646@mips.complang.tuwien.ac.at> <68VYL.2039083$9sn9.730653@fx17.iad> <2023Apr10.164359@mips.complang.tuwien.ac.at> <KwVYL.1294624$gGD7.576331@fx11.iad> <864jlyz93n.fsf@linuxsc.com> <kdwuM.10045$O8ab.7764@fx40.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="c20a25be915291dc36b638c24dc060a9";
logging-data="4029631"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/A4/NsUF+iRsLWBGcQiJxWh/wuBVfESgc="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:aC0LGr0j6pHV7dOO8DOz9JXuquc=
sha1:0Wpil/g3DgA6qhjPp0ysqwgH210=
 by: Tim Rentsch - Sat, 22 Jul 2023 14:12 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>
>> [...]
>>
>>> An array object that encompasses the entire virtual address space
>>> is easily defined on modern (nonsegmented) processors, in which case
>>> ptrdiff_t is defined for subtraction of any two virtual addresses.
>>
>> The ISO C standard does not make that guarantee.
>
> I never made such a claim.

I didn't say you did.

> This isn't comp.lang.c

I'm not trying to start a debate. My comment was offered
for the benefit of people who are interested in knowing
the facts. I believe that such people participate in this
newsgroup, and some of those may not read comp.lang.c.

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

<86edkzt72l.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: On the pitfalls of C and UB: C23 seems to be even worse. :-(
Date: Sun, 23 Jul 2023 00:34:10 -0700
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <86edkzt72l.fsf@linuxsc.com>
References: <u0f6gf$32irr$1@dont-email.me> <a533d5c4-8dca-44eb-ba43-bf38ab7f9f34n@googlegroups.com> <2023Apr4.073909@mips.complang.tuwien.ac.at> <u10pbe$259vd$1@dont-email.me> <u1132k$26kkr$1@dont-email.me> <86ilaexnet.fsf@linuxsc.com> <u9ccv0$2t51r$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="978ba9513973d7ae87a57600d2a2537b";
logging-data="215363"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qwM1DUoecud2yocxhhFnca8uUBLzGXtE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:9nlSGMHiOyfaMY4D+EkAOMl+lSg=
sha1:F2es1tyJ2q42O3kEfI+3zurHI+s=
 by: Tim Rentsch - Sun, 23 Jul 2023 07:34 UTC

chrisq <devzero@nospam.com> writes:

> On 7/20/23 21:50, Tim Rentsch wrote:

[regarding pointer comparison and memmove()]

>> It is possible to implement memmove() in standard C using only
>> well-defined comparisons. (I suppose I should add that some
>> people would object based on the belief that the means of doing
>> so is horrible, which I don't necessarily share, but either way I
>> still think it's worth pointing out that it's possible, and even
>> feasible.)
>
> Programming in C or speaking natural language is fundamentally
> about communication. If you want to be sure that the receiver
> understands what you are saying, speak clearly and make no
> assumptions about the receiver's knowledge.
>
> Always program a strict subset of C here, no clever stuff
> and most of it works first time, apart from typos. Saves
> so much time in the long run. Can't be bothered doing
> it right to start is the reason why we have so much bad code
> to put up with...

I don't necessarily agree with your advice, but whether
I do or not has no bearing on my comments.


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

Pages:123456789
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor