Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

One man's constant is another man's variable. -- A. J. Perlis


devel / comp.lang.c / Re: you think rust may *DE*throne c?

SubjectAuthor
* you think rust may outthrone c?fir
`* Re: you think rust may outthrone c?Blue-Maned_Hawk
 +- Re: you think rust may outthrone c?jak
 +* Re: you think rust may outthrone c?fir
 |`- Re: you think rust may outthrone c?fir
 +* Re: you think rust may outthrone c?rek2 hispagatos
 |`* Re: you think rust may outthrone c?Kaz Kylheku
 | `* Re: you think rust may outthrone c?Kalevi Kolttonen
 |  +* Re: you think rust may outthrone c?Scott Lurndal
 |  |`* Re: you think rust may outthrone c?Kalevi Kolttonen
 |  | +- Re: you think rust may outthrone c?Kaz Kylheku
 |  | +* Re: you think rust may outthrone c?Bart
 |  | |`* Re: you think rust may outthrone c?Kalevi Kolttonen
 |  | | +* Re: you think rust may outthrone c?Bart
 |  | | |+* Re: you think rust may outthrone c?Kalevi Kolttonen
 |  | | ||`* Re: you think rust may outthrone c?Kaz Kylheku
 |  | | || `- Re: you think rust may outthrone c?Kalevi Kolttonen
 |  | | |`* Re: you think rust may outthrone c?David Brown
 |  | | | `* Re: you think rust may outthrone c?Kalevi Kolttonen
 |  | | |  +* Re: you think rust may outthrone c?David Brown
 |  | | |  |`* Re: you think rust may outthrone c?Kaz Kylheku
 |  | | |  | `- Re: you think rust may outthrone c?Kalevi Kolttonen
 |  | | |  `* Re: you think rust may outthrone c?Kaz Kylheku
 |  | | |   `* Re: you think rust may outthrone c?Kalevi Kolttonen
 |  | | |    `* Re: you think rust may outthrone c?David Brown
 |  | | |     +* Re: you think rust may outthrone c?Scott Lurndal
 |  | | |     |`- Re: you think rust may outthrone c?Keith Thompson
 |  | | |     `* Re: you think rust may outthrone c?Keith Thompson
 |  | | |      +- Re: you think rust may outthrone c?David Brown
 |  | | |      `* Re: you think rust may outthrone c?Malcolm McLean
 |  | | |       `* Re: you think rust may outthrone c?David Brown
 |  | | |        `* Re: you think rust may outthrone c?Malcolm McLean
 |  | | |         `* Re: you think rust may outthrone c?David Brown
 |  | | |          +- Re: you think rust may outthrone c?fir
 |  | | |          +* Re: you think rust may outthrone c?fir
 |  | | |          |`* Re: you think rust may outthrone c?fir
 |  | | |          | `- Re: you think rust may outthrone c?fir
 |  | | |          `* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |           `* Re: you think rust may outthrone c?Bart
 |  | | |            +* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |            |`* Re: you think rust may outthrone c?Malcolm McLean
 |  | | |            | +* Re: you think rust may outthrone c?David Brown
 |  | | |            | |+* Re: you think rust may outthrone c?Malcolm McLean
 |  | | |            | ||+* Re: you think rust may outthrone c?David Brown
 |  | | |            | |||+* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |            | ||||`* Re: you think rust may outthrone c?Tim Rentsch
 |  | | |            | |||| `- Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |            | |||`* Re: you think rust may outthrone c?Bart
 |  | | |            | ||| +- Re: you think rust may outthrone c?Malcolm McLean
 |  | | |            | ||| `- Re: you think rust may outthrone c?David Brown
 |  | | |            | ||`- Re: you think rust may outthrone c?Scott Lurndal
 |  | | |            | |`* Re: you think rust may outthrone c?Kaz Kylheku
 |  | | |            | | +- Re: you think rust may outthrone c?David Brown
 |  | | |            | | `* Re: you think rust may outthrone c?jak
 |  | | |            | |  `* Re: you think rust may outthrone c?Kaz Kylheku
 |  | | |            | |   +- Re: you think rust may outthrone c?jak
 |  | | |            | |   `- Re: you think rust may outthrone c?Tim Rentsch
 |  | | |            | `* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |            |  `* Re: you think rust may outthrone c?Malcolm McLean
 |  | | |            |   +- Re: you think rust may outthrone c?David Brown
 |  | | |            |   `- Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |            `* Re: you think rust may outthrone c?David Brown
 |  | | |             `* Re: you think rust may outthrone c?fir
 |  | | |              +* Re: you think rust may outthrone c?Chris M. Thomasson
 |  | | |              |`* Re: you think rust may outthrone c?David Brown
 |  | | |              | +* Re: you think rust may outthrone c?Chris M. Thomasson
 |  | | |              | |+* Re: you think rust may outthrone c?Chris M. Thomasson
 |  | | |              | ||+- Re: you think rust may outthrone c?Chris M. Thomasson
 |  | | |              | ||+* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |              | |||`- Re: you think rust may outthrone c?Chris M. Thomasson
 |  | | |              | ||`- Re: you think rust may outthrone c?fir
 |  | | |              | |`- Re: you think rust may outthrone c?Bart
 |  | | |              | `- Re: you think rust may outthrone c?Chris M. Thomasson
 |  | | |              `* Re: you think rust may outthrone c?fir
 |  | | |               `* Re: you think rust may outthrone c?Bart
 |  | | |                +* Re: you think rust may outthrone c?Keith Thompson
 |  | | |                |+* Re: you think rust may outthrone c?Bart
 |  | | |                ||+* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |                |||`* Re: you think rust may outthrone c?Bart
 |  | | |                ||| +- Re: you think rust may outthrone c?Kaz Kylheku
 |  | | |                ||| +* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |                ||| |+* Re: you think rust may outthrone c?David Brown
 |  | | |                ||| ||+- Re: you think rust may outthrone c?Bart
 |  | | |                ||| ||`* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |                ||| || `* Re: you think rust may outthrone c?David Brown
 |  | | |                ||| ||  `* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |                ||| ||   +* Re: you think rust may outthrone c?David Brown
 |  | | |                ||| ||   |`* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |                ||| ||   | `* Re: you think rust may outthrone c?David Brown
 |  | | |                ||| ||   |  `- Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |                ||| ||   `* Re: you think rust may outthrone c?Kaz Kylheku
 |  | | |                ||| ||    `- Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |                ||| |+* Re: you think rust may outthrone c?Bart
 |  | | |                ||| ||+* Re: you think rust may outthrone c?Ike Naar
 |  | | |                ||| |||`- Re: you think rust may outthrone c?Bart
 |  | | |                ||| ||+* Re: you think rust may outthrone c?David Brown
 |  | | |                ||| |||`* Re: you think rust may outthrone c?Bart
 |  | | |                ||| ||| `- Re: you think rust may outthrone c?David Brown
 |  | | |                ||| ||`* Re: you think rust may outthrone c?Ben Bacarisse
 |  | | |                ||| || +- Re: you think rust may outthrone c?Kaz Kylheku
 |  | | |                ||| || +* Re: you think rust may outthrone c?Malcolm McLean
 |  | | |                ||| || `* Re: you think rust may outthrone c?Bart
 |  | | |                ||| |`* Re: you think rust may outthrone c?Scott Lurndal
 |  | | |                ||| `* Re: you think rust may outthrone c?Keith Thompson
 |  | | |                ||`- Re: you think rust may outthrone c?Keith Thompson
 |  | | |                |`* Re: you think rust may outthrone c?Kaz Kylheku
 |  | | |                `* Re: you think rust may outthrone c?fir
 |  | | +* Yeah, C is harder than many programming languages. Your point? (Was: you think Kenny McCormack
 |  | | +* Re: you think rust may outthrone c?Po Lu
 |  | | `* Re: you think rust may outthrone c?Kaz Kylheku
 |  | +* Re: you think rust may outthrone c?David Brown
 |  | `- Re: you think rust may outthrone c?Po Lu
 |  `* Re: you think rust may outthrone c?Anton Shepelev
 `* Re: you think rust may outthrone c?Bonita Montero

Pages:123456789101112131415161718192021222324252627282930313233343536373839
Re: you think rust may outthrone c?

<u8s0fc$33sa$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.hispagatos.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 17:26:04 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Sender: <untosten@0.0.0.0>
Message-ID: <u8s0fc$33sa$2@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org> <u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com> <u8rhrs$1b2m$1@dont-email.me> <u8rpuu$24m6$3@dont-email.me> <u8rsjl$2i8m$1@dont-email.me> <u8rvj6$31dr$1@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 17:26:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c222fe64990f4521cd1777af39dfbc31";
logging-data="102282"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QgLkp/ikCgK8qp+afn/R0/Z78VCFbg7o="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:TG53vJL+/UHCa8I6CIvXQ2+fY/s=
 by: Kalevi Kolttonen - Fri, 14 Jul 2023 17:26 UTC

David Brown <david.brown@hesbynett.no> wrote:
>> Your code containing UB can work fine in the environment that you
>> use, but it might not work when you compile it elsewhere.
>
> Just like other bugs.

Could you please provide a simple example of such a bug,
i.e. it must a bug that is not caused by relying on
Implementation Defined behavior or Undefined Behavior?

Sorry, but my comprehension is a bit slow today.

br,
KK

Re: Why not? (killfiles)

<u8s56q$28fal$1@news.xmission.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.c
Subject: Re: Why not? (killfiles)
Date: Fri, 14 Jul 2023 18:46:50 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <u8s56q$28fal$1@news.xmission.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8rje8$1gfk$1@dont-email.me> <u8rl1f$2862a$1@news.xmission.com> <u8rm2a$1pha$1@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 18:46:50 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2374997"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Fri, 14 Jul 2023 18:46 UTC

In article <u8rm2a$1pha$1@dont-email.me>,
Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
>Kenny McCormack <gazelle@shell.xmission.com> wrote:
>> - such as Keith Thompson, who is so fabulously insane, that
>> I always enjoy reading his stuff.
>
>During all these years I have never seen a single
>sign of Keith Thompson's "insanity". On the contrary,
>his posts are always informative and helpful.

You do you. As long as he stays entertaining, that's all that really matters.

--
He must be a Muslim. He's got three wives and he doesn't drink.

Re: you think rust may outthrone c?

<20230714083843.644@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 20:43:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <20230714083843.644@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 20:43:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11930d4b9116140760b34e67a40ec333";
logging-data="144375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rAjPImlp73qiDRDxVf/ZYvKMLrJiIXvo="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:Z4LJmy7HSF5L2x1nefPe7YF61Bc=
 by: Kaz Kylheku - Fri, 14 Jul 2023 20:43 UTC

On 2023-07-14, Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
> Bart <bc@freeuk.com> wrote:
>> On 13/07/2023 21:30, Kalevi Kolttonen wrote:
>> So the answer is to do constant battle with the Rust Borrow Checker?
>
> I make no recommendations. I just observed the fact that
> in order to write safe C code, you need considerable amount
> of knowledge about the C standards in order to avoid the
> pitfalls.

The vast majority of it is common sense, like don't try to calculate
out-of-range numbers, or fit out of range numbers into a smaller type.

What's hard in C is writing a large body of code in which you don't make
any accidental mistakes which are obvious if pointed out by someone else
(rather than something you don't know).

Then there is the difficulty of all that manual memory management, and
also explicit concurrency, if you're required to use those.)

Separately from that, what is hard is defending against external inputs,
where it is obvious that there are combinatiosn of inputs that will
cause the program's operations to violate the rules.

For instance, it's quite clumsy to check something as simple as whether
two numbers can be added without overflow in C. Whereas in some
assembly languages, we can just try it and check a flag. Done.
that.

The result is that it's easy to code happy paths in C, and to "document
away" bad inputs as being the caller's or user's problem.

For instance, it's very easy to write a language interpreter in C,
if it's okay for that interpreter to inherit undefined behaviors
of C. (But it usually isn't.)

If we look at the POSIX specification for Awk, it basically waves its
hands in the area of numeric safety. Unless noted otherwise, Awk
expressions just follow C. Situations like division by zero or overflow
are therefore undefined behavior in Awk.

If you're writing an Awk implementation in C, in order to be conforming
to POSIX in the area of arithmetic, you don't have to do anything
special. Your + operator can just pull out some numbers out of the
operand nodes, and blindly hand them down to the C + operator without
any checks. The problem has been punted to the programmer writing the
Awk script.

This is the sort of thing that Rust is striking at: to be able
to write programs with happy paths in which there is implicit safety
for the unhappy inputs.

Problem is we already have plenty of languages which do that, that
are nice to program in and efficient. That's why Rust needs this
marketing positioning as a C and C++ replacement. It's not a compelling
replacement for anything managed, especially if it has a decent
compiler. You will not convince users of managed languages that it's bad
to be able to send an object anywhere in a program, and have multiple
references to it.

I don't believe there is a large application area where problems are so
simple that some primitive single-owner memory management is good
enough, yet we cannot use a nice garbage collected language. And even
in that area, we have to consider the alternative of using two
languages: a nice managed language, with small amount of C (that's
easy to develop and get right).

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Yeah, C is harder than many programming languages. Your point?

<20230714134412.703@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Yeah, C is harder than many programming languages. Your point?
Date: Fri, 14 Jul 2023 20:46:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <20230714134412.703@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <u8rb8h$28204$1@news.xmission.com>
<u8rbk9$lv9$1@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 20:46:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11930d4b9116140760b34e67a40ec333";
logging-data="144375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18le0bO/ZjxMQWv38Xn2RmX3gF9XuX9bLM="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:2Cr2LEaPu10DsRFkWSkVOLYm+5s=
 by: Kaz Kylheku - Fri, 14 Jul 2023 20:46 UTC

On 2023-07-14, Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
> Kenny McCormack <gazelle@shell.xmission.com> wrote:
>> In article <u8qqpv$3v3pg$1@dont-email.me>,
>> Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
>> ...
>>>> (I don't know Java. Does it really take care of memory management?)
>>>
>>>Yes, it has automatic garbage collection. Those who have started
>>>programming using Java can have considerable difficulties with
>>>manual memory management in C. They are not used to it at all.
>>
>> Much the same could be said about people who start out programming Excel
>> macros. When they start programming in C, they find it very strange that
>> you have to do memory management at all.
>
> You are quite right. The point is that manual memory management
> is an additional burden to the programmer.

The Rust rhetoric is that C++ is bad too, and C++ has great tools for
avoiding manual memory management. You can easily write a program
in C++98 that you can just about prove that has no memory leaks or
use-after-free.

You can also write yourself some numeric classes in C++ with overloaded
operators, such that operations that overflow or underflow will
throw exceptions.

> Creating serious memory leaks is one of the dangerous possibilities
> when coding in C. That danger can be avoided altogether when writing
> in e.g. Java.

There is no shortage of easy-to-use languages which avoid memory leaks
and use-after-free. You're not going to convince their users to switch
to Rust, where they have to deal with unfamiliar restrictions on the
propagation of pointers through the program.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Posting for our own amusement (Was: Yeah, C is harder than many programming languages. Your point?)

<20230714134750.198@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Posting for our own amusement (Was: Yeah, C is harder than many
programming languages. Your point?)
Date: Fri, 14 Jul 2023 20:53:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <20230714134750.198@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rho3$188s$1@dont-email.me> <u8rij9$28357$2@news.xmission.com>
<e63aea0c-76ee-4e60-93b2-e22fd996759cn@googlegroups.com>
<u8rmnn$287lt$1@news.xmission.com> <u8rpnf$24m6$2@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 20:53:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11930d4b9116140760b34e67a40ec333";
logging-data="144375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cnF2K0IYzl+4FJQdNAhvY5aoqylIueVI="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:FUaMZffIR42nfsXkF+e8pSH/M5g=
 by: Kaz Kylheku - Fri, 14 Jul 2023 20:53 UTC

On 2023-07-14, David Brown <david.brown@hesbynett.no> wrote:
> On 14/07/2023 16:39, Kenny McCormack wrote:
>> In article <e63aea0c-76ee-4e60-93b2-e22fd996759cn@googlegroups.com>,
>> james...@alumni.caltech.edu <jameskuyper@alumni.caltech.edu> wrote:
>> ...
>>> Many of us post responses to questions out of a sincere desire to be
>>> helpful to the person posting the message, as well as to other people who
>>> may read it. Sometimes we post out of a desire to be helpful to people
>>> who might be confused by a message posted by someone else.
>>
>> I get that that's the standard comeback to my assertion.
>> It may be true at some level, but in the end it all boils down to the same
>> thing. You post because it makes you feel good to do so.
>>
>
> There's a difference between posting for your own enjoyment, and posting
> for your own amusement.

There is big quality range in area of amusement.

For instance, I wouldn't find it amusing to stand on an overpass and
spit on cars passing below, but for some people, it's the highlight
of their existence.

For exactly the same reason I wouldn't be amused by posting the kind of
drivel that comes out of "fir", which is close to being the Usenet
equivalent of "hocking loogies".

It's not enough to justify yourself by *that* you're amused, but
by *how* you are amused.

Re: you think rust may outthrone c?

<20230714135401.17@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 21:01:26 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <20230714135401.17@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <u8r94r$dn9$1@dont-email.me>
<u8ra47$hl8$1@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 21:01:26 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11930d4b9116140760b34e67a40ec333";
logging-data="144375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/CAEaV6jBw4IOWJXu8O7F6gf8WaTrdHs8="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:j/HruNf63WZfk8Vryg9bimHI0F4=
 by: Kaz Kylheku - Fri, 14 Jul 2023 21:01 UTC

On 2023-07-14, Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
> Bart <bc@freeuk.com> wrote:
>> So what do you you use to code in? I'm guessing Python
>> and/or Java.
>
> Bash, AWK, Python, C. My University courses had to be
> completed using Java, but that was over 20 years ago.
>
>>> Some people have suggested that Linux kernel modules should
>>> be allowed to be written in Rust, too. I do not know whether
>>> that suggestion was ever accepted by the Linux kernel developers.
>>>
>>>> Portable C is a myth. Even C you wrote 5 minutes ago might not work,
>>>> even on the exact same machine and OS, if someone uses a different set
>>>> of compiler options.
>>>
>>> No. Lots of C programs are quite portable. That includes e.g. Linux
>>> kernel,
>>
>> The Linux kernel is at least 26 million lines of code. It's not all
>> found in the same machine! There are lots of different files for
>> different hardware.
>
> As far as I know, the "different files" are mostly CPU architecture
> speficic assembly code. I could be wrong, though. Maybe you can offer
> some proof?
>
>> So a driver for one device will be different from that for another: you
>> write dedicated C code for each, so portability is not needed.
>
> Ummm...What? I just don't get it. Of course you write dedicated
> code for different devices. What does that have to do with portability?

Well, firstly, drivers *are* often highly portable, similarly to any
other code in the kernel. The same chip can be driven in the same way
when it is found on a different kind of bus attached to a different CPU.

But Bart has the valid point that no single machine contains all the
drivers that there are.

And some devices, even if their drivers are portable in principle,
are found only in some kinds of machines. E.g. I think only PC's
have a text console. Or certain Intel chips for USB.

A lot of kernel contributions come from SoC vendors, where you have
not only architecture support but board support. A large number of
different boards fall under the same architecture, e.g. 32 bit ARM.
Yet they have features that are entirely board specific. The code
will never be compiled other than by someone building the kernel
for that specific board. That code could use ARM inline assembly; ther
ewill never be a version of that board that isn't ARM, so it doesn't
matter.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: you think rust may outthrone c?

<20230714140153.112@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 21:02:42 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <20230714140153.112@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <u8r94r$dn9$1@dont-email.me>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 21:02:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11930d4b9116140760b34e67a40ec333";
logging-data="144375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197fLBzadjc8LUCgoKsOsGWwx16cECUEwQ="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:7fs1qzu2Us9cbDfOuFH5hnEgkrg=
 by: Kaz Kylheku - Fri, 14 Jul 2023 21:02 UTC

On 2023-07-14, Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
> David Brown <david.brown@hesbynett.no> wrote:
>> However, none of the code needs to be /widely/ portable. All targets
>> have 32-bit int, 8-bit char, either 32-bit or 64-bit pointers, use ASCII
>> basic character sets, and have many other aspects in common.
>
> I suppose one can argue pretty endlessly about the true
> meaning of "portable code". How many platforms must it run
> on in order to quality as portable? I think there is no
> single correct answer to that question.

If you don't qualify "portable" somehow, like by listing the kinds
of platforms supported, then it means maximally portable.

You open yourself to being roasted for the code assuming ASCII,
8 bit chars, pointers being all equal sized and all that.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: you think rust may outthrone c?

<u8se8v$4ip3$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 21:21:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Sender: <untosten@0.0.0.0>
Message-ID: <u8se8v$4ip3$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org> <u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <u8r94r$dn9$1@dont-email.me> <u8ra47$hl8$1@dont-email.me> <20230714135401.17@kylheku.com>
Injection-Date: Fri, 14 Jul 2023 21:21:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c222fe64990f4521cd1777af39dfbc31";
logging-data="150307"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+WdFbIVbZ+b5p38xwwLMAEEzVxhOndLTo="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:fokxFLLlai7NgLVptb+L0QM7NoA=
 by: Kalevi Kolttonen - Fri, 14 Jul 2023 21:21 UTC

Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> A lot of kernel contributions come from SoC vendors, where you have
> not only architecture support but board support. A large number of
> different boards fall under the same architecture, e.g. 32 bit ARM.
> Yet they have features that are entirely board specific. The code
> will never be compiled other than by someone building the kernel
> for that specific board. That code could use ARM inline assembly; ther
> ewill never be a version of that board that isn't ARM, so it doesn't
> matter.

Thanks! It is clear to me that my understanding about those things
was completely non-existent... I only recently realized that even my
television might run Linux now, so the level of my ignorance is high
concerning many important issues.

br,
KK

Re: you think rust may outthrone c?

<20230714140259.603@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 21:25:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 102
Message-ID: <20230714140259.603@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com>
<u8rhrs$1b2m$1@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 21:25:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11930d4b9116140760b34e67a40ec333";
logging-data="152762"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+v/smJhbLuVNI8Qeeo4DROc2mSCTHcgZI="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:xm0NN/AhJtEAfEn24NnYTxRXYH4=
 by: Kaz Kylheku - Fri, 14 Jul 2023 21:25 UTC

On 2023-07-14, Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
> Po Lu <luangruo@yahoo.com> wrote:
>> kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
>>
>>> No. Lots of C programs are quite portable. That includes e.g. Linux
>>> kernel, BSD kernels, PostgreSQL, Apache, Postfix, and many,
>>> many other Unix daemons. PostgreSQL runs not only on Unix
>>> but even on Windows. Possibly OpenLDAP does, too.
>>
>> Yet none of these programs strictly conform to a Standard. They are
>> more or less conforming programs, meaning that they are acceptable to
>> the C implementations that they have been ported to.
>
> You could well be right. But invoking UB is something so evil
> that no C or C++ program must ever do it, meaning that the
> programmers must know enough to avoid it.

This is simply untrue. Undefined behavior is one of the main areas
of vendor extension.

Formally, undefined behavior means that ISO C provides no definition
of behavior. That doesn't mean nobody else provides no definition
of behavior.

A strict interpretation of ISO C is possible under which the use of
any functions that are not in ISO C, and not in the program (i.e. not
defined somewhere in a translation unit of the program) are undefined
behavior. If you use a function called read(), but haven't written
that yourself, and the program translates, links and executes anyway,
that is thanks to undefined behavior.

Merely including a nonstandard header like <unistd.h> is also undefined
behavior. The header is not defined by the program, so there are two
possibilities:

1. The header is not found, which is a diagnosable error.

2. The header is found, necessarily outside of the program, and
replaced by its content. But that content is unknown; it is not
specified by ISO C. The implementor has to document what it is;
e.g. that it provides a POSIX implementation with a <unistd.h>
header. A different implementor, who hates POSIX users and their
programs, could document that #incluce <unistd.h> wipes the disk and
powers down the machine; that would be ISO C conforming.

Secondly, there can be undefined behaviors according to ISO C for
which we can infer a definition anyway, in spite of not having
a documented definition from a vendor.

If we have the source code to a compiler or library (or are otherwise
able to reverse engineer those tools), we can study what the actual
behavior is. We might find that the undefined construct is handled in
such a way that no undefined behavior takes place in the implementation,
and that the construct is handled according to some meaningful rules. If
we freeze that toolchain source code (or else keep monitoring new
releases for regressions), we will get those reliable behaviors.

We can infer definedness of behavior of the object code. Even though
a[i] = i++ is undefined, once we obtain an object file, we can
disassemble it, and find no undefined behavior at the machine level. We
can reverse-engineer it to determine the specification of actual
behavior, and find it to be consistent and reliable. (And then, we can
change the source code so that it achieves that same actual behavior
(possibly even identical object code) in a defined way: a good strategy
for eliminating ambiguity, while reducing the risk of breaking behaviors
relied on by unknown downstream users.)

We can infer definedness of behavior by certain reasoning which leads
to the conclusion that, certain technolology being what it is, it
is not possible for the behavior to go astray.

For instance, if we know that translation units are compiled in
complete isolation from each other, and if we know that translated
files do not retain any information about type (such as the names of
structures and structure members) then we can conclude that two
structure types which have the same shape in different translation
units are de facto compatible.

If one translation unit has functions that accept a "struct point { int
x, y; }", we can link it with another translation unit which declares
the type as "struct cell { int a, b; }" and calls the functions using
that type. ISO C says it is undefined, but it's not possible to write
a program which demonstrates a problem, under a given object file
and linking technology.

For that matter, we could make it "struct cell { long a, b; }" if
the type int and long have the same representation. All that matters
is that we don't break the ABI. But the concept of ABI is outside of
ISO C.

Mixed langauge programming is udefined. If you make program with
C modules and Fortran modules, it's neither a well-defined C program,
nor a well-defined Fortran program.

So the topic of undefined behavior is broad and nuanced; it's not
just a simple category of "bad thing that must never happen",

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: you think rust may outthrone c?

<20230714142515.610@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 21:32:18 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <20230714142515.610@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <u8r94r$dn9$1@dont-email.me>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<u8roha$24m6$1@dont-email.me>
Injection-Date: Fri, 14 Jul 2023 21:32:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="11930d4b9116140760b34e67a40ec333";
logging-data="152762"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rXuFun+aB0F7WsfiQ09UIZc/oJQaLwOo="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:mv3xyMlrEk0V73sLiFUrWfRYYKc=
 by: Kaz Kylheku - Fri, 14 Jul 2023 21:32 UTC

On 2023-07-14, David Brown <david.brown@hesbynett.no> wrote:
> On 14/07/2023 14:08, Kalevi Kolttonen wrote:
>> David Brown <david.brown@hesbynett.no> wrote:
>>> However, none of the code needs to be /widely/ portable. All targets
>>> have 32-bit int, 8-bit char, either 32-bit or 64-bit pointers, use ASCII
>>> basic character sets, and have many other aspects in common.
>>
>> I suppose one can argue pretty endlessly about the true
>> meaning of "portable code". How many platforms must it run
>> on in order to quality as portable? I think there is no
>> single correct answer to that question.
>>
>
> Certainly "portable" has different meanings to different people.

I would hope that "portable" has *all* those meanings simultaneously to
every person gathered here. I understand that both as

- being capable of running on computers found in retrocomputing museums,
as well as Arduinos, and supercomputers.

- running on Windows, Mac and a few Unix-likes.

- and other possibilities.

Different definitions for different situations.

The word does exclude something that runs on exactly one installation
of one machine. Everything else is portable to some extent.

E.g. most well-behaved 80386 code is portable to Core i9.

Re: you think rust may outthrone c?

<u8sf33$4nc3$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 21:35:31 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Sender: <untosten@0.0.0.0>
Message-ID: <u8sf33$4nc3$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org> <u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <u8r94r$dn9$1@dont-email.me> <u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me> <20230714140153.112@kylheku.com>
Injection-Date: Fri, 14 Jul 2023 21:35:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c222fe64990f4521cd1777af39dfbc31";
logging-data="155011"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+s3M/r5FyB/6069ZXCVNxF1LUa8a3t6M="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:3Bf8FHAPOSgjh5V+KBmNuFPKPWg=
 by: Kalevi Kolttonen - Fri, 14 Jul 2023 21:35 UTC

Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> If you don't qualify "portable" somehow, like by listing the kinds
> of platforms supported, then it means maximally portable.

I see. Is the meaning more formally defined somewhere in an
exact way? Or is it just common knowledge?

My programming skills are so poor that I am 100% convinced I
could not write maximally portable C code. I have too many
incorrect assumptions and would be sure to rely on e.g. some
Implementation Defined behavior. This is no joke but that's
just the way it is. I do not blame C for this - it is entirely
my fault.

> You open yourself to being roasted for the code assuming ASCII,
> 8 bit chars, pointers being all equal sized and all that.

It is sad, but sometimes I take it for granted that the chars are
always exactly eight bits. This is so even though I realize that
it is no more "right" than other choices.

br,
KK

Re: Yeah, C is harder than many programming languages. Your point?

<u8sfso$4pg3$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: Yeah, C is harder than many programming languages. Your point?
Date: Fri, 14 Jul 2023 21:49:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 34
Sender: <untosten@0.0.0.0>
Message-ID: <u8sfso$4pg3$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <u8rb8h$28204$1@news.xmission.com> <u8rbk9$lv9$1@dont-email.me> <20230714134412.703@kylheku.com>
Injection-Date: Fri, 14 Jul 2023 21:49:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c222fe64990f4521cd1777af39dfbc31";
logging-data="157187"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fO5zs6BHU2rbZPXlsDfi4xVZETUgf1F0="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:6lekDQl2V4c9v5mLPyBLCSmQVLc=
 by: Kalevi Kolttonen - Fri, 14 Jul 2023 21:49 UTC

Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> On 2023-07-14, Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
>> Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>> In article <u8qqpv$3v3pg$1@dont-email.me>,
>>> Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
> The Rust rhetoric is that C++ is bad too, and C++ has great tools for
> avoiding manual memory management. You can easily write a program
> in C++98 that you can just about prove that has no memory leaks or
> use-after-free.

Did the Rust folks have this crazy attitude against C++
right from the start when the language was released, and when
everyone was raving about it? If so, I may have read about
it then, but have forgotten it.

Unfortunately I may even have believed it back then. Some of the
Rust features seemed to be improvements over C, but after all,
I thought that you could achieve safe enough code with C
provided that you are careful. What is more, as I am a pretty
old and lazy man now, I did not want to spend my any part of
my life learning Rust.

Anyway, I never realized that the ISO C++ committee has managed
to make C++ that much better. That sounds fantastic.

> There is no shortage of easy-to-use languages which avoid memory leaks
> and use-after-free. You're not going to convince their users to switch
> to Rust, where they have to deal with unfamiliar restrictions on the
> propagation of pointers through the program.

That makes sense.

br,
KK

Re: you think rust may outthrone c?

<u8sgf0$4pg3$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 21:58:56 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 42
Sender: <untosten@0.0.0.0>
Message-ID: <u8sgf0$4pg3$2@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org> <u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <20230714083843.644@kylheku.com>
Injection-Date: Fri, 14 Jul 2023 21:58:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c222fe64990f4521cd1777af39dfbc31";
logging-data="157187"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+uhAEEH2BSKhMvBAyk0X50OYH80l2xiUY="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:/x1CgjE945n3TE9byelsDRfdOFI=
 by: Kalevi Kolttonen - Fri, 14 Jul 2023 21:58 UTC

Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> If we look at the POSIX specification for Awk, it basically waves its
> hands in the area of numeric safety. Unless noted otherwise, Awk
> expressions just follow C. Situations like division by zero or overflow
> are therefore undefined behavior in Awk.

It is awful but I did not know that AWK programs could have undefined
behaviour. I thought that division-by-zero's consequence would be to
always terminate the program.

> If you're writing an Awk implementation in C, in order to be conforming
> to POSIX in the area of arithmetic, you don't have to do anything
> special. Your + operator can just pull out some numbers out of the
> operand nodes, and blindly hand them down to the C + operator without
> any checks. The problem has been punted to the programmer writing the
> Awk script.

That's so terrible.

> This is the sort of thing that Rust is striking at: to be able
> to write programs with happy paths in which there is implicit safety
> for the unhappy inputs.

OK.

> Problem is we already have plenty of languages which do that, that
> are nice to program in and efficient. That's why Rust needs this
> marketing positioning as a C and C++ replacement. It's not a compelling
> replacement for anything managed, especially if it has a decent
> compiler. You will not convince users of managed languages that it's bad
> to be able to send an object anywhere in a program, and have multiple
> references to it.

I am trying to think very hard back, but I don't remember hearing
that the Rust folks claimed that it is supposed to replace C++. My
current understanding was that it was a *C language* replacement
or at least, an improvement in some areas when compared to C.

Thanks for providing correct information.

br,
KK

Re: you think rust may outthrone c?

<u8sgov$4pg3$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 22:04:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Sender: <untosten@0.0.0.0>
Message-ID: <u8sgov$4pg3$3@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org> <u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <u8r94r$dn9$1@dont-email.me> <u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me> <u8roha$24m6$1@dont-email.me> <20230714142515.610@kylheku.com>
Injection-Date: Fri, 14 Jul 2023 22:04:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="df074145f7c9c9b70247792428e73095";
logging-data="157187"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VGEKI0keNFare6WURFYyzC0BBXHKpRbM="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:eUVp2MvUem27wT4r1mBZCLCZYKk=
 by: Kalevi Kolttonen - Fri, 14 Jul 2023 22:04 UTC

Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> - being capable of running on computers found in retrocomputing museums,
> as well as Arduinos, and supercomputers.

It is amazing that some people can actually write
code that is so widely portable. It is a pretty
mind-boggling fact that it runs so many different
platforms!

I guess code like that has good chance of surviving
for a long time.

br,
KK

Re: you think rust may outthrone c?

<u8si9j$53qt$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 22:30:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 140
Sender: <untosten@0.0.0.0>
Message-ID: <u8si9j$53qt$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org> <u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com> <u8rhrs$1b2m$1@dont-email.me> <20230714140259.603@kylheku.com>
Injection-Date: Fri, 14 Jul 2023 22:30:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="df074145f7c9c9b70247792428e73095";
logging-data="167773"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/FI5RlwlGUvhnmnftUmm0uPJMOd4LCVv0="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:UDj2d0pD92kGU794bqZgi/7Jkns=
 by: Kalevi Kolttonen - Fri, 14 Jul 2023 22:30 UTC

Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> On 2023-07-14, Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
>> Po Lu <luangruo@yahoo.com> wrote:
>>> kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
>>>
>>>> No. Lots of C programs are quite portable. That includes e.g. Linux
>>>> kernel, BSD kernels, PostgreSQL, Apache, Postfix, and many,
>>>> many other Unix daemons. PostgreSQL runs not only on Unix
>>>> but even on Windows. Possibly OpenLDAP does, too.
>>>
>>> Yet none of these programs strictly conform to a Standard. They are
>>> more or less conforming programs, meaning that they are acceptable to
>>> the C implementations that they have been ported to.
>>
>> You could well be right. But invoking UB is something so evil
>> that no C or C++ program must ever do it, meaning that the
>> programmers must know enough to avoid it.
>
> This is simply untrue. Undefined behavior is one of the main areas
> of vendor extension.

Oh no! What have I been thinking!

> Formally, undefined behavior means that ISO C provides no definition
> of behavior.
That I knew...

> That doesn't mean nobody else provides no definition
> of behavior.

....and that I did not! So foolish of me, this is terrible.
I have had serious delusions about the proper meaning for many
years without ever even realizing it.

> A strict interpretation of ISO C is possible under which the use of
> any functions that are not in ISO C, and not in the program (i.e. not
> defined somewhere in a translation unit of the program) are undefined
> behavior. If you use a function called read(), but haven't written
> that yourself, and the program translates, links and executes anyway,
> that is thanks to undefined behavior.

The amount of my ignorance really hurts. Delusions are a horrible
thing to have.

> Merely including a nonstandard header like <unistd.h> is also undefined
> behavior. The header is not defined by the program, so there are two
> possibilities:
>
> 1. The header is not found, which is a diagnosable error.
>
> 2. The header is found, necessarily outside of the program, and
> replaced by its content. But that content is unknown; it is not
> specified by ISO C. The implementor has to document what it is;
> e.g. that it provides a POSIX implementation with a <unistd.h>
> header. A different implementor, who hates POSIX users and their
> programs, could document that #incluce <unistd.h> wipes the disk and
> powers down the machine; that would be ISO C conforming.
>
> Secondly, there can be undefined behaviors according to ISO C for
> which we can infer a definition anyway, in spite of not having
> a documented definition from a vendor.

Got it.

> If we have the source code to a compiler or library (or are otherwise
> able to reverse engineer those tools), we can study what the actual
> behavior is. We might find that the undefined construct is handled in
> such a way that no undefined behavior takes place in the implementation,
> and that the construct is handled according to some meaningful rules. If
> we freeze that toolchain source code (or else keep monitoring new
> releases for regressions), we will get those reliable behaviors.

I am not at all sure whether I got it or not. Not blaming you, though.

> We can infer definedness of behavior of the object code. Even though
> a[i] = i++ is undefined, once we obtain an object file, we can
> disassemble it, and find no undefined behavior at the machine level. We
> can reverse-engineer it to determine the specification of actual
> behavior, and find it to be consistent and reliable. (And then, we can
> change the source code so that it achieves that same actual behavior
> (possibly even identical object code) in a defined way: a good strategy
> for eliminating ambiguity, while reducing the risk of breaking behaviors
> relied on by unknown downstream users.)

Man, that's too complicated for me.

> We can infer definedness of behavior by certain reasoning which leads
> to the conclusion that, certain technolology being what it is, it
> is not possible for the behavior to go astray.

As a more general conclusion, that makes a bit more sense to me.

> For instance, if we know that translation units are compiled in
> complete isolation from each other, and if we know that translated
> files do not retain any information about type (such as the names of
> structures and structure members) then we can conclude that two
> structure types which have the same shape in different translation
> units are de facto compatible.

Does that mean some kind of isomorphism between the two structure
types?

> If one translation unit has functions that accept a "struct point { int
> x, y; }", we can link it with another translation unit which declares
> the type as "struct cell { int a, b; }" and calls the functions using
> that type. ISO C says it is undefined, but it's not possible to write
> a program which demonstrates a problem, under a given object file
> and linking technology.

Well I guess it can work since the names are not important, it all
depends on the identical shape...?

> For that matter, we could make it "struct cell { long a, b; }" if
> the type int and long have the same representation. All that matters
> is that we don't break the ABI. But the concept of ABI is outside of
> ISO C.

I got it.

> Mixed langauge programming is udefined. If you make program with
> C modules and Fortran modules, it's neither a well-defined C program,
> nor a well-defined Fortran program.

I got it, too.

> So the topic of undefined behavior is broad and nuanced; it's not
> just a simple category of "bad thing that must never happen",

I am shocked and mildly amused by my horrendous delusions. Your
explanation was indeed broad yet detailed. My deluded view was
that consisting of "bad thing that must never happen". I was
also *way too sure* that my view was correct... So pathetic.

Many thanks for your time and setting the record straigth.

Why does wisdom take so long to achieve... :-(

br,
KK

Re: you think rust may outthrone c?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 15:48:24 -0700
Organization: None to speak of
Lines: 38
Message-ID: <875y6myurr.fsf@nosuchdomain.example.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com>
<u8rhrs$1b2m$1@dont-email.me> <20230714140259.603@kylheku.com>
<u8si9j$53qt$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="87f6d716c5ac4529008aa6c06931dee0";
logging-data="170651"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1vEoJDioUa/ncbuoXOLpK"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:EF+uafzgMF2x5oxjIu+j4oM3KRo=
sha1:CsGx0ZhWhnlnqgXFOXJzyJOw7gQ=
 by: Keith Thompson - Fri, 14 Jul 2023 22:48 UTC

kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
> Kaz Kylheku <864-117-4973@kylheku.com> wrote:
[...
>> This is simply untrue. Undefined behavior is one of the main areas
>> of vendor extension.
>
> Oh no! What have I been thinking!
>
>> Formally, undefined behavior means that ISO C provides no definition
>> of behavior.
>
> That I knew...
>
>> That doesn't mean nobody else provides no definition
>> of behavior.
>
> ...and that I did not! So foolish of me, this is terrible.
> I have had serious delusions about the proper meaning for many
> years without ever even realizing it.
>
>> A strict interpretation of ISO C is possible under which the use of
>> any functions that are not in ISO C, and not in the program (i.e. not
>> defined somewhere in a translation unit of the program) are undefined
>> behavior. If you use a function called read(), but haven't written
>> that yourself, and the program translates, links and executes anyway,
>> that is thanks to undefined behavior.
>
> The amount of my ignorance really hurts. Delusions are a horrible
> thing to have.

[...]

Learning something shouldn't be painful.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: you think rust may outthrone c?

<u8sjqj$57ab$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Fri, 14 Jul 2023 22:56:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Sender: <untosten@0.0.0.0>
Message-ID: <u8sjqj$57ab$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com> <u8rhrs$1b2m$1@dont-email.me> <20230714140259.603@kylheku.com> <u8si9j$53qt$1@dont-email.me> <875y6myurr.fsf@nosuchdomain.example.com>
Injection-Date: Fri, 14 Jul 2023 22:56:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="df074145f7c9c9b70247792428e73095";
logging-data="171339"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18OUihMPi4BNrWFw3BD5iahDCeSHg80TMg="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:WtcUlSc2kJk3Xi69pMO4xtsYk24=
 by: Kalevi Kolttonen - Fri, 14 Jul 2023 22:56 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Learning something shouldn't be painful.

It should not be, but when you realize that you have
been a delusional fool for several years, you really
cannot be very proud of that. Not only it, but I
am also guilty of *spreading false information*.

br,
KK

Re: you think rust may outthrone c?

<s0dttu5ln36.fsf@yahoo.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luang...@yahoo.com (Po Lu)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Sat, 15 Jul 2023 14:12:45 +0800
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <s0dttu5ln36.fsf@yahoo.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com>
<u8rhrs$1b2m$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a743761c787f4ac6dc06188975107177";
logging-data="355572"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JPM1b0BYLiYZdrjSWe26E17iinrW1WS0="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:Ln9zk7mYlomBIxqZcrrvOPMbeFY=
sha1:nZn+93irmGdwRcn5D/8G5H5RA+Q=
 by: Po Lu - Sat, 15 Jul 2023 06:12 UTC

kalevi@kolttonen.fi (Kalevi Kolttonen) writes:

> Po Lu <luangruo@yahoo.com> wrote:
>> kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
>>
>>> No. Lots of C programs are quite portable. That includes e.g. Linux
>>> kernel, BSD kernels, PostgreSQL, Apache, Postfix, and many,
>>> many other Unix daemons. PostgreSQL runs not only on Unix
>>> but even on Windows. Possibly OpenLDAP does, too.
>>
>> Yet none of these programs strictly conform to a Standard. They are
>> more or less conforming programs, meaning that they are acceptable
>> to
>> the C implementations that they have been ported to.
>
> You could well be right. But invoking UB is something so evil
> that no C or C++ program must ever do it, meaning that the
> programmers must know enough to avoid it.
>
> Since you seem to be confident about your claim, is it possible
> for you to describe what aspects of Postfix are non-corforming
> C code?

Not strictly conforming? Easy: any code that assumes char is 8 bits
wide, or that int can hold values larger than 32766.

> Speaking of MTAs, Sendmail was/is portable enough so that it runs
> on practically every modern and not-so-modern UNIX. This being
> the case, one could assume that its C code must be very
> standards compliant, no? What do you think?

What exactly is ``standards compliance''?
Mere conformance, or strict conformance?

Re: you think rust may outthrone c?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Sat, 15 Jul 2023 01:05:05 -0700
Organization: None to speak of
Lines: 66
Message-ID: <871qh9zjke.fsf@nosuchdomain.example.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com>
<u8rhrs$1b2m$1@dont-email.me> <s0dttu5ln36.fsf@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="87f6d716c5ac4529008aa6c06931dee0";
logging-data="372026"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XbYURV0GtiWlMq9T3qOK3"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:DXxdTBz9VvbbL+AuYXeKYujUjjo=
sha1:hvWLlIL7kuoFV8KYdiha6dlPh6I=
 by: Keith Thompson - Sat, 15 Jul 2023 08:05 UTC

Po Lu <luangruo@yahoo.com> writes:
> kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
>> Po Lu <luangruo@yahoo.com> wrote:
>>> kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
>>>> No. Lots of C programs are quite portable. That includes e.g. Linux
>>>> kernel, BSD kernels, PostgreSQL, Apache, Postfix, and many,
>>>> many other Unix daemons. PostgreSQL runs not only on Unix
>>>> but even on Windows. Possibly OpenLDAP does, too.
>>>
>>> Yet none of these programs strictly conform to a Standard. They are
>>> more or less conforming programs, meaning that they are acceptable
>>> to
>>> the C implementations that they have been ported to.
>>
>> You could well be right. But invoking UB is something so evil
>> that no C or C++ program must ever do it, meaning that the
>> programmers must know enough to avoid it.
>>
>> Since you seem to be confident about your claim, is it possible
>> for you to describe what aspects of Postfix are non-corforming
>> C code?
>
> Not strictly conforming? Easy: any code that assumes char is 8 bits
> wide, or that int can hold values larger than 32766.

32767.

Or any code whose behavior depends on those things. For example, this:

#include <stdio.h>
#include <limits.h>
int main(void) {
printf("%d\n", INT_MAX);
}

is in a sense 100% portable to any hosted implementation, but it's not
strictly conforming.

>> Speaking of MTAs, Sendmail was/is portable enough so that it runs
>> on practically every modern and not-so-modern UNIX. This being
>> the case, one could assume that its C code must be very
>> standards compliant, no? What do you think?
>
> What exactly is ``standards compliance''?
> Mere conformance, or strict conformance?

A "conforming program" is one that is acceptable to a conforming
implementation -- an almost absurdly weak condition. If there's a C
implementation that accepts Fortran programs as an extension (after
issuing any required diagnostic), then a Forgran program is a
"conforming program", though I doubt that the authors meant the
definition to be quite that loose.

But I think there's an intermediate level of conformance: a "correct
program".

A program that is correct in all other aspects, operating on correct
data, containing unspecified behavior shall be a correct program and
act in accordance with 5.1.2.3.

(This in section 4 of the ISO C standard.)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: you think rust may outthrone c?

<u8tn5n$blno$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Sat, 15 Jul 2023 08:59:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Sender: <untosten@0.0.0.0>
Message-ID: <u8tn5n$blno$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org> <u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com> <u8rhrs$1b2m$1@dont-email.me> <s0dttu5ln36.fsf@yahoo.com>
Injection-Date: Sat, 15 Jul 2023 08:59:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="df074145f7c9c9b70247792428e73095";
logging-data="382712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TRBL5Gppa7qKxxsr3cAxtP7Jn3UH9mek="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:IeN6TO0USiy1vguTGir9kI7GS2k=
 by: Kalevi Kolttonen - Sat, 15 Jul 2023 08:59 UTC

Po Lu <luangruo@yahoo.com> wrote:
> Not strictly conforming? Easy: any code that assumes
> char is 8 bits wide, or that int can hold values
> larger than 32766.

Thanks, I see. I am pretty sure that the latter
is what most programs do.

>> Speaking of MTAs, Sendmail was/is portable enough so that it runs
>> on practically every modern and not-so-modern UNIX. This being
>> the case, one could assume that its C code must be very
>> standards compliant, no? What do you think?
>
> What exactly is ``standards compliance''?
> Mere conformance, or strict conformance?

The "strict conformance" seems unattainable.

br,
KK

Re: Yeah, C is harder than many programming languages. Your point?

<fc21c865-8f4a-4918-aa03-028f470a2ae0n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ad4:4e03:0:b0:635:de3c:17da with SMTP id dl3-20020ad44e03000000b00635de3c17damr48876qvb.6.1689412869824;
Sat, 15 Jul 2023 02:21:09 -0700 (PDT)
X-Received: by 2002:a05:6808:2383:b0:3a4:316f:37cd with SMTP id
bp3-20020a056808238300b003a4316f37cdmr6596549oib.5.1689412869519; Sat, 15 Jul
2023 02:21:09 -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.lang.c
Date: Sat, 15 Jul 2023 02:21:09 -0700 (PDT)
In-Reply-To: <1ff95ae2-737b-4b7c-9ac9-fe79b9414d2bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.17; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.17
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <u8rb8h$28204$1@news.xmission.com>
<u8rbk9$lv9$1@dont-email.me> <137ee20e-2873-452e-b667-449a81fa109en@googlegroups.com>
<u8rf36$10ns$1@dont-email.me> <1ff95ae2-737b-4b7c-9ac9-fe79b9414d2bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fc21c865-8f4a-4918-aa03-028f470a2ae0n@googlegroups.com>
Subject: Re: Yeah, C is harder than many programming languages. Your point?
From: profesor...@gmail.com (fir)
Injection-Date: Sat, 15 Jul 2023 09:21:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: fir - Sat, 15 Jul 2023 09:21 UTC

piątek, 14 lipca 2023 o 14:46:51 UTC+2 fir napisał(a):
> piątek, 14 lipca 2023 o 14:29:41 UTC+2 Kalevi Kolttonen napisał(a):
> > fir <profes...@gmail.com> wrote:
> > > imo you write a lot of nonsenses in this thread (many belifs not much real)
> > > to teh extent i somewhat feel sorry i stated the question - i forgot that quite
> > > usulally people when some wtate soem question not give answer but produce
> > > a stream of nonsenses.. i thought maybe i will learn something on this
> > > rust maybe (this one i cant learn) instead nonsenses on c..but well you may
> > > continue ofc
> > First of all, I guess you are some kind of a programmer, but
> > you have serious problem with your spelling. Your posts are
> > absolutely awful to read. Try spell checking of some kind
> > and learn to write proper English.
> >
> > Second, what exactly is the point of your emotional outburst?
> >
> > If you think that I write "nonsense", then please point out the
> > errors. It is incredibly stupid to rant about "nonsense" without
> > providing any kind of reasoning. Your post is just worthless garbage.
> >
> you just produce a lot of nonreal belifs and not real points - in discussions here
> many people with time i guess more used to real points.. i dont want to talk on
> c here as i talked on it for 2 decades..the question was more like if ruest can really outhrone
> c and say if there are some real points /reasons related to that
>
> howewer crowd of programmers often works like you do - its more driven by blifs and
> nonsenses (as in kase of pony++) than real points..so lack of real points may not be deciding
> sadly

so the answer is probably may (like probably any low-lewel compiled language could) but probably will not doo.. hovever i guess when some amount of helpfull language additions will appear such new language may outthrone c then - probably...wchich may be pity as c unside his faults (like this passing via pointer, no multiply values return and to wack support for modularisation/header stuff, also no vector arithmetic and macros who allow to make chaos and so on) has very strong core unseen imo in any other alnguege i seen...
we will see

Re: you think rust may outthrone c?

<1e547403-da8a-45ce-a178-79a8f62c1569n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:40d2:b0:767:e5f8:8372 with SMTP id g18-20020a05620a40d200b00767e5f88372mr52993qko.8.1689421329022;
Sat, 15 Jul 2023 04:42:09 -0700 (PDT)
X-Received: by 2002:a05:6870:6185:b0:1b3:e896:9bf4 with SMTP id
a5-20020a056870618500b001b3e8969bf4mr6875481oah.6.1689421328732; Sat, 15 Jul
2023 04:42:08 -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.lang.c
Date: Sat, 15 Jul 2023 04:42:08 -0700 (PDT)
In-Reply-To: <u8s0fc$33sa$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=92.28.30.149; posting-account=0B-afgoAAABP6274zLUJKa8ZpdIdhsYx
NNTP-Posting-Host: 92.28.30.149
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org> <u8p0kv$h9r$1@matrix.hispagatos.org>
<20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me>
<UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me>
<u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me>
<s3ma5vyveo9.fsf@yahoo.com> <u8rhrs$1b2m$1@dont-email.me> <u8rpuu$24m6$3@dont-email.me>
<u8rsjl$2i8m$1@dont-email.me> <u8rvj6$31dr$1@dont-email.me> <u8s0fc$33sa$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1e547403-da8a-45ce-a178-79a8f62c1569n@googlegroups.com>
Subject: Re: you think rust may outthrone c?
From: gw7...@aol.com (Paul N)
Injection-Date: Sat, 15 Jul 2023 11:42:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Paul N - Sat, 15 Jul 2023 11:42 UTC

On Friday, July 14, 2023 at 6:26:20 PM UTC+1, Kalevi Kolttonen wrote:
> David Brown <david...@hesbynett.no> wrote:
> >> Your code containing UB can work fine in the environment that you
> >> use, but it might not work when you compile it elsewhere.
> >
> > Just like other bugs.
> Could you please provide a simple example of such a bug,
> i.e. it must a bug that is not caused by relying on
> Implementation Defined behavior or Undefined Behavior?

I think you could get such a bug if you assume that the letters of the alphabet all have consecutive values. It's true of many computers today, but was not true of the mainframe when I was at university, which used EBCDIC instead of ASCII. As I understand it, this is not "Implementation Defined behaviour" because there is no requirement to say what values the letters have.

Re: you think rust may outthrone c?

<u8u3ff$cr1u$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Sat, 15 Jul 2023 12:29:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Sender: <untosten@0.0.0.0>
Message-ID: <u8u3ff$cr1u$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <20230713104558.553@kylheku.com> <u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad> <u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me> <u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com> <u8rhrs$1b2m$1@dont-email.me> <u8rpuu$24m6$3@dont-email.me> <u8rsjl$2i8m$1@dont-email.me> <u8rvj6$31dr$1@dont-email.me> <u8s0fc$33sa$2@dont-email.me> <1e547403-da8a-45ce-a178-79a8f62c1569n@googlegroups.com>
Injection-Date: Sat, 15 Jul 2023 12:29:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="df074145f7c9c9b70247792428e73095";
logging-data="420926"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RFkNXELPjG2zMmtj3GowUzhWqaxhvI0k="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.3.12-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:gxRejCFH60k2osPjgZJSxlyGX8Q=
 by: Kalevi Kolttonen - Sat, 15 Jul 2023 12:29 UTC

Paul N <gw7rib@aol.com> wrote:
> I think you could get such a bug if you assume that
> the letters of the alphabet all have consecutive values.
> It's true of many computers today, but was not true of
> the mainframe when I was at university, which used
> EBCDIC instead of ASCII. As I understand it, this is
> not "Implementation Defined behaviour" because there is
> no requirement to say what values the letters have.

I see, thanks. That would satisfy the requirements I gave.

However, saying "just like other bugs" somehow seems to
give the impression that there would be many bugs that
could satisfy the requirements.

Finding a single example is a very good thing, but it
would be more convincing if there were more examples.

br,
KK

Re: you think rust may outthrone c?

<u8u3ge$cscl$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Sat, 15 Jul 2023 14:30:05 +0200
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <u8u3ge$cscl$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <u8r94r$dn9$1@dont-email.me>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 15 Jul 2023 12:30:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e7b27cc64bddfd10e9658095efcdba7b";
logging-data="422293"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/YBI1LcLGhiAGjemGplXZlWgLHXgQmrXE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:w5LwoiXCBCGoZCq3XpIK9fVODEQ=
In-Reply-To: <u8sf33$4nc3$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Sat, 15 Jul 2023 12:30 UTC

On 14/07/2023 23:35, Kalevi Kolttonen wrote:
> Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>> If you don't qualify "portable" somehow, like by listing the kinds
>> of platforms supported, then it means maximally portable.
>
> I see. Is the meaning more formally defined somewhere in an
> exact way? Or is it just common knowledge?
>
> My programming skills are so poor that I am 100% convinced I
> could not write maximally portable C code. I have too many
> incorrect assumptions and would be sure to rely on e.g. some
> Implementation Defined behavior. This is no joke but that's
> just the way it is. I do not blame C for this - it is entirely
> my fault.
>
>> You open yourself to being roasted for the code assuming ASCII,
>> 8 bit chars, pointers being all equal sized and all that.

These things should not be a problem. Keep your pointers as pointers of
compatible type - there is rarely a good reason for wanting to convert a
pointer-to-int to a pointer-to-float, and certainly not for mixing data
pointers and function pointers. Think about what your pointers are
pointing at, and use that as the basis for types. And if you ever think
you need to mess with pointer types, you are probably better using
memcpy/memmove.

Use "char" to hold characters, and never use it for anything else, then
its size doesn't matter, nor does the character encoding. The only
other use for any kind of "char" should be "unsigned char" and its
pointers, which is the C type for low-level memory access. (It should
have been called "byte", to match the standard's term, but it's far too
late for that now.)

For integer types, prefer the types from <stdint.h>. They let you give
more explicit size information and support efficient code generation
across a wide range of targets.

>
> It is sad, but sometimes I take it for granted that the chars are
> always exactly eight bits. This is so even though I realize that
> it is no more "right" than other choices.
>

There is really only two areas where CHAR_BIT is greater than 8. One is
a few dinosaur mainframes, and the other is DSP devices. It is rare
that anyone needs to write code that is portable to such targets.

Generally if your code really depends on something like the size of
CHAR_BIT, it is already limited in its portability by things you are
doing, such as OS system calls.

Re: you think rust may outthrone c?

<u8u45v$cscl$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Sat, 15 Jul 2023 14:41:35 +0200
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <u8u45v$cscl$2@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8p0kv$h9r$1@matrix.hispagatos.org> <20230713104558.553@kylheku.com>
<u8phd0$3niul$1@dont-email.me> <UpYrM.257503$W7d4.2562@fx18.iad>
<u8pmt9$3o80g$1@dont-email.me> <u8q0q4$3p89v$1@dont-email.me>
<u8qqpv$3v3pg$1@dont-email.me> <s3ma5vyveo9.fsf@yahoo.com>
<u8rhrs$1b2m$1@dont-email.me> <20230714140259.603@kylheku.com>
<u8si9j$53qt$1@dont-email.me> <875y6myurr.fsf@nosuchdomain.example.com>
<u8sjqj$57ab$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 15 Jul 2023 12:41:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e7b27cc64bddfd10e9658095efcdba7b";
logging-data="422293"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19k3Qh4VJJLtyfBbvzIA1nYYyg8Dgy357k="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:lHDd6mSkoV2EMZvQKYZwqJlxzkY=
Content-Language: en-GB
In-Reply-To: <u8sjqj$57ab$1@dont-email.me>
 by: David Brown - Sat, 15 Jul 2023 12:41 UTC

On 15/07/2023 00:56, Kalevi Kolttonen wrote:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> Learning something shouldn't be painful.
>
> It should not be, but when you realize that you have
> been a delusional fool for several years, you really
> cannot be very proud of that. Not only it, but I
> am also guilty of *spreading false information*.
>

In the C standards, the term "undefined behaviour" is defined as:

"behavior, upon use of a nonportable or erroneous program construct or
of erroneous data, for which this International Standard imposes no
requirements"

So extensions to C are undefined behaviour in respect to the C standard,
but defined behaviour in respect to the implementation. As far as the
standard is concerned, and therefore for the C language in general,
signed integer overflow is undefined behaviour. However, if you are
coding for "gcc -fwrapv", then the behaviour is fully defined by the
implementation.

So "undefined behaviour" can mean "not defined by the C standards", or
it can also mean "not defined by the C standards, the implementation's
documentation, and any other standards, manuals, or references relevant
to the program in question". It is important to be clear what you mean
by the term at the time (I am not always good enough at that myself).
Here in comp.lang.c, the default for all terms is the definition in the
C standards. But sometimes the second meaning (or a variation of it) is
more relevant.


devel / comp.lang.c / Re: you think rust may *DE*throne c?

Pages:123456789101112131415161718192021222324252627282930313233343536373839
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor