Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Innovation distinguishes between a leader and a follower. -- Steve Jobs (1955-2011)


devel / comp.lang.c / Re: you think rust may outthrone 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?

<u95q1j$1k1sq$1@bluemanedhawk.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!news.eternal-september.org!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@gmail.com (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 06:37:39 -0400
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <u95q1j$1k1sq$1@bluemanedhawk.eternal-september.org>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8o2jf$3isv1$1@bluemanedhawk.eternal-september.org>
<u93q47$19p2n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
Injection-Date: Tue, 18 Jul 2023 10:37:39 -0000 (UTC)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="826e56eb82069d8d77ceb5606f19a3ae";
logging-data="1705882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/iQuRwe8nDqCTOVnYsfp3/XtIlyWZNDhQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:i8qNSSle/V9uR28tr9O4ww+H7nU=
In-Reply-To: <u93q47$19p2n$1@dont-email.me>
Content-Language: en-US
 by: Blue-Maned_Hawk - Tue, 18 Jul 2023 10:37 UTC

On 7/17/23 12:26, Bonita Montero wrote:
> Am 13.07.2023 um 07:37 schrieb Blue-Maned_Hawk:
>>
>> ​Ain't nothing gonna dethrone C until a total revolution of the modern
>> computing ecosystem; in other words, replacing C would require
>> replacing everything else all at once.
>
> C has already been dethroned many times.
​I think you and i have different definitions of "dethrone" here.
--
⚗︎ | /blu.mɛin.dʰak/ | shortens to "Hawk" | he/him/his/himself/Mr.
bluemanedhawk.github.io
Bitches stole my whole ass ␔🭖᷿᪳𝼗᷍⏧𒒫𐻾ࣛ↉�⃣ quoted-printable, can't
have shit in Thunderbird 😩

Re: you think rust may outthrone c?

<u95rn3$1k9hq$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 12:06:11 +0100
Organization: A noiseless patient Spider
Lines: 108
Message-ID: <u95rn3$1k9hq$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jul 2023 11:06:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c87bb4c669806a0280a3b231e98491a3";
logging-data="1713722"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gyuTtX77hynvvkpDqhD/VTVpr0AMjIKQ="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:hFvaHFI2+f8Nvg6hQ1ABOkD8hgA=
In-Reply-To: <87edl6uf9y.fsf@bsb.me.uk>
 by: Bart - Tue, 18 Jul 2023 11:06 UTC

On 18/07/2023 03:25, Ben Bacarisse wrote:
> Bart <bc@freeuk.com> writes:
>> OK. But in that case why is C's so-called portability touted so much?
>
> Who touts it? Picking an old version of C, and sticking to the standard
> can result in reasonably portable programs, but the whole notion is
> fraught with misunderstandings and is not easy to define. C is often
> thought of as being very portable because almost every platform has a C
> compiler, but writing highly portable is very hard and few people know
> how to do it well. Does that mean that C is portable or does it mean it
> isn't? The question is not an easy one to answer.

So why pick on [criticise] a method of accessing the top bit of a 32-bit
word that is going to work on all platforms of interest?

What's really going on is that because that method might be tagged as UB
(/because/ of various obscure architectures where it won't work), we're
not allowed to use it in cases (perhaps the majority) where there would
be no problem.

> C has changed quite a bit too

C's changes are minor. Fortran changed from being unstructured, to
structured, among other major differences.

>>> gcc -std=c11 -pedantic -D_ANSI_SOURCE -fno-common \
>>> -fsanitize=undefined -Wbad-function-cast \
>>> -Wstrict-prototypes -Wall -Wextra -Wformat-nonliteral
-Wcast-align \
>>> -Winline -Wundef -Wcast-qual -Wshadow -Wconversion -ffloat-store
>>>
>>> so I can see problems as early as possible.
>>
>> So you're using a version of the language defined by those options.
>
> That's what every compiler ever written does: process a language defined
> by the author(s), the options used and the bugs in the implementation.

gcc allows for myriad different dialects, and that's before extensions
are considered.

My bcc compiler allowed for just two: there was an `-old` switch to
enable features I didn't want to have, but were necessary to compile
some existing programs.

(One consequence of gcc allowing deprecated features by default is that
uses of those features are not curtailed; they are perpetuated.)

> I really don't know what you hope to gain by saying obvious things like
> this other than to (incorrectly) imply that C -- the language -- is not
> defined by it's defining documents -- the ISO standards -- but by
> compiler options.

I've given examples in the past where the same C program either:

* Passed with 0 lines of errors or warnings

* Passed with 28,000 lines of warnings and notes (on a 40Kloc input)

Or it could fail if you were to use -Werror too. In the case where it
produced 28,000 lines, you had to peruse all those lines to find out if
there was an 'error:` line, to discover if it had passed or not.

All I want to know is: is my program a valid C program, but gcc will not
tell me; apparently *i* have to tell *it* how strictly it should treat
my code!

This is like someone taking an exam, telling the examiner how strictly
they should mark their paper.

I think you're just not seeing it. A compiler should take more
responsibility for deciding a valid program, or the language should do
so if it merely leaves things to the implementation.

> Fortunately, gcc is a quality compiler and these options make the
> language it accepts as close to ISO standard C (the 2011 version) as I
> can get it, but there will always be bugs and misunderstandings.

With your options I managed to still produce an executable for this:

int main() {main(1, 2.0, "three", main, main, main();}

My bcc compiler failed it /unless/ I specified '-old'.

Without any options, gcc said nothing about it (a quality compiler indeed!).

>> BTW I can't remember using any options when compiling Fortran.
>
> Really? Odd. I remember needing multiple JCL cards to invoke the IBM
> 360 FORTRAN compiler, but you didn't get much choice about the language.
> It implemented IBM's interpretation of FORTRAN IV and you were stuck
> with it, though you could choose to write in a more portable subset.

This the manual for Fortran IV for RSX11M:

https://usermanual.wiki/Document/RSX11MV1FortranIVUsersGuide.3451439411/view

Compiler options are on page 1-6. There aren't many, and only one
affects the behaviour of the program: /I4 (which is default) to use an
i32 implicit type for integers instead of i16.

The other Fortran IVs I used ran on mainframes; I can't remember the
details.

Re: you think rust may outthrone c?

<u95rup$1k9hq$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.chmurka.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 12:10:17 +0100
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <u95rup$1k9hq$2@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87v8ehsv2q.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jul 2023 11:10:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c87bb4c669806a0280a3b231e98491a3";
logging-data="1713722"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18b0b570q4Dh5jVVpvCdZAo89lcIOO4Qqw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:rKAdnDdE1TR1fGlll7ZhYNc007c=
In-Reply-To: <87v8ehsv2q.fsf@nosuchdomain.example.com>
 by: Bart - Tue, 18 Jul 2023 11:10 UTC

On 18/07/2023 05:27, Keith Thompson wrote:
> Bart <bc@freeuk.com> writes:
> [...]
>> (In the case of Fortran, I remember using machine-specific types such
>> as INTEGER*4 (i32) in 1979; was there anything similar in C before
>> C99?
>>
>> Funny that the non-low-level language had machine types, and
>> close-to-the-metal C didn't!
>
> So your complaint is that C has fixed-width types *now*, but didn't
> acquire them until 24 years ago? It's difficult to imagine any
> explanation that would satisfy you.
>
> And you're referring to the intN_t types as "machine types"?
> Why do you call them that?

OK, so, N has the values of 8, 16, 32, 64, which by some remarkable
coincidence are also the bit-widths supported by most current hardware,
but that doesn't make them machine types?

Re: you think rust may outthrone c?

<u95se9$1k9hq$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 12:18:33 +0100
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <u95se9$1k9hq$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>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<u94don$1c1k4$1@dont-email.me> <u95eqh$1ipij$1@dont-email.me>
<u95f7s$1ioti$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 18 Jul 2023 11:18:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c87bb4c669806a0280a3b231e98491a3";
logging-data="1713722"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/VA+7Tva/h6fD3dfWDWGly7jBch0V7MzM="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:8yL2Y1fgDy7laDaYN/3xDRvYVfU=
In-Reply-To: <u95f7s$1ioti$2@dont-email.me>
 by: Bart - Tue, 18 Jul 2023 11:18 UTC

On 18/07/2023 08:33, Chris M. Thomasson wrote:
> On 7/18/2023 12:26 AM, David Brown wrote:
>> On 18/07/2023 00:01, Chris M. Thomasson wrote:
>>> On 7/17/2023 3:01 PM, fir wrote:
>>>> poniedziałek, 17 lipca 2023 o 08:22:38 UTC+2 David Brown napisał(a):
>>>>>   C is a  high level language.
>>>>
>>>> i propose to say c is mid-level language.. i would say its closer to
>>>> low-lewel than high-level
>>>
>>> I tend to agree with that.
>>>
>>
>> I don't know if there is any kind of "official" definition of a
>> high-level language.  But I think a reasonable choice would be to say
>> that a low-level language is one that is defined in terms of the
>> hardware.  Operations in the language do what the hardware says they
>> will do.  A high-level language is one that is defined independently
>> of any particular hardware.
>>
>> By that definition, C is a high-level language - it is defined in
>> terms of an abstract machine.  It has some implementation-dependent
>> factors (as do all languages - though C has perhaps more than most,
>> and is more explicit about it than most).  But those affect particular
>> implementations of the language rather than the language itself.
>>
>> Another way to distinguish low and high level languages is to consider
>> the usage, and suitability of usage, in "low level" or "systems"
>> coding, close to the hardware, as distinct from more abstract coding.
>> Python is then "high level", with native support for infinite
>> precision integers, hash maps, standard libraries for
>> application-level features, etc.  C is "low level" for supporting
>> efficient and direct hardware access and systems coding.  But C++
>> would then be both a low-level /and/ a high-level language.
>>
>> I personally think it is more accurate to say that C is a low-level
>> high-level language, or a high-level language targeting low-level
>> programming.  A binary low/high classification is not particularly
>> useful - it is perhaps better to think of a scale, in which a language
>> like Python would be significantly higher than C.  But as C would
>> score well above 0 here, it is very definitely a high level language.
>
> Well, I can use C to steal bits from a pointer. Pretty nice and useful,
> from time to time, so to speak... :^)

I have a dynamic scripting language where I can do those tricks too.
It's not just the domain of C, or low-level languages!

I would place my two languages (M and Q here, where A=assembly, C=C,
P=Python) on this scale:

A---C-M----Q---------P---------- ...

Way off to the right you'll probably find functional ones like Haskell,
and there are probably even higher level languages too.

I would call A a low-level language, and C and M lower-level HLLs.

Rust might be somewhere between C and P, but the truth is that is it not
a linear scale.

Re: you think rust may outthrone c?

<u95t32$1k9hq$4@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 12:29:38 +0100
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <u95t32$1k9hq$4@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95ggt$1iuls$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 18 Jul 2023 11:29:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c87bb4c669806a0280a3b231e98491a3";
logging-data="1713722"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Mdidcnkw795Ct82LP8Bw+UmBrQvTx/JY="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:ebdF3llXXdXNOCyLFDgAzw1ibX8=
In-Reply-To: <u95ggt$1iuls$1@dont-email.me>
 by: Bart - Tue, 18 Jul 2023 11:29 UTC

On 18/07/2023 08:55, David Brown wrote:
> On 18/07/2023 04:25, Ben Bacarisse wrote:

>> That's what every compiler ever written does: process a language defined
>> by the author(s), the options used and the bugs in the implementation.
>> I really don't know what you hope to gain by saying obvious things like
>> this other than to (incorrectly) imply that C -- the language -- is not
>> defined by it's defining documents -- the ISO standards -- but by
>> compiler options.
>>
>
> One thing to remember is Bart's comparison here.  He is forever
> comparing C to his own language - a language that is, in a sense,
> constant because there is only one implementation of it.  There are no
> flags that affect the language, because what might be an optional
> feature in another compiler, is for him a fixed change to the language
> implemented by changing the compiler source.  With only one user, and
> only one compiler, there are no options or variations.  It is fully
> portable - all programs in his language can be compiled by all
> implementations.  There are no conflicts between language definition
> documents and implementations, because there are no documents defining
> the language - the language is whatever the implementation does.  There
> is no scope for alternative interpretation of the definition - with one
> user, there is always consensus.  There are no flaws in the language -
> it works exactly as its users want it to.
>
> Because Bart has primarily used his own language (or languages) for many
> decades, he struggles to understand how things work for a language that
> has developed over decades, has formal standards, has countless
> implementations, countless users, and an enormous quantity of code
> written to wildly varying qualities.

That's not true. My language has evolved considerably since the the
first version in the early 80s, far more than C, but not quite as much
as Fortran.

There are have been countless compilers and various machine targets,
some ILs, and even ones generating C32 and C64 (versions of C that must
be compiled with -m32 or -m64).

Actually even now it is volatile, and only recently I decided to keep it
stable.

The actual level of it (see my post before this one) is not much higher
than C, but I have been able to experiment with lots of different ideas
that suit this level of language.

That's why I can be so vocal about C.

I also understand why C development needs to be constrained, yet many
things could be done but aren't, like making compilers default to the
newest, safest standards, and /require/ options to compile legacy code.

Re: you think rust may outthrone c?

<878rbdv2zk.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 13:05:51 +0100
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <878rbdv2zk.fsf@bsb.me.uk>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<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>
<u8u3ge$cscl$1@dont-email.me>
<87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<u94don$1c1k4$1@dont-email.me> <u95eqh$1ipij$1@dont-email.me>
<u95f7s$1ioti$2@dont-email.me> <u95fct$1ioti$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a217b73d67e4bddf393a76a6fd405420";
logging-data="1730515"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/syPlhUp3qDzchlJuLjkcm4E+3O0zlKU="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:tH4sVh8cLnhQPvrKLwAGYHxoSgo=
sha1:M1iP1Ajxz/sUmZxSmEqtQ4f1Hd4=
X-BSB-Auth: 1.c476569945879b2ae0c1.20230718130551BST.878rbdv2zk.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 18 Jul 2023 12:05 UTC

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:

> Fun times! Storing meta data in a pointer, then masking it off before we
> actually use the pointer. Undefined behavior for sure, but can it work and
> be used in highly beneficial ways, yup.

This can be done without any undefined behaviour. It's not "portable"
but that's not the same as UB.

--
Ben.

Re: you think rust may outthrone c?

<slrnubd0l6.6tn.ike@iceland.freeshell.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ike...@sdf.org (Ike Naar)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 12:16:38 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <slrnubd0l6.6tn.ike@iceland.freeshell.org>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me>
Injection-Date: Tue, 18 Jul 2023 12:16:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b0a4b080e1d36a857a0cff64da2c010";
logging-data="1732004"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+KvedGpyBdlAMxOlF21HKc"
User-Agent: slrn/1.0.3 (Patched for libcanlock3) (NetBSD)
Cancel-Lock: sha1:yjY0fEnHROONMafPeLWKb1zxjbw=
 by: Ike Naar - Tue, 18 Jul 2023 12:16 UTC

On 2023-07-18, Bart <bc@freeuk.com> wrote:
> On 18/07/2023 03:25, Ben Bacarisse wrote:
> >>> gcc -std=c11 -pedantic -D_ANSI_SOURCE -fno-common \
> >>> -fsanitize=undefined -Wbad-function-cast \
> >>> -Wstrict-prototypes -Wall -Wextra -Wformat-nonliteral
> -Wcast-align \
> >>> -Winline -Wundef -Wcast-qual -Wshadow -Wconversion -ffloat-store
> >>>
> >>> so I can see problems as early as possible.
>
> With your options I managed to still produce an executable for this:
>
> int main() {main(1, 2.0, "three", main, main, main();}

How did you manage to produce an executable for that?
Here, gcc says:

a.c:1:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
int main() {main(1, 2.0, "three", main, main, main();}
^~~~
a.c: In function 'main':
a.c:1:53: error: expected ')' before ';' token
int main() {main(1, 2.0, "three", main, main, main();}
^
a.c:1:54: error: expected ';' before '}' token
int main() {main(1, 2.0, "three", main, main, main();}
^
and no executable is produced.

Re: you think rust may outthrone c?

<u962v2$1lbh5$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 14:09:54 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <u962v2$1lbh5$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me> <slrnubd0l6.6tn.ike@iceland.freeshell.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jul 2023 13:09:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c87bb4c669806a0280a3b231e98491a3";
logging-data="1748517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193wjNraOdxQXEV2bYfGIDXBhIB8z9bxYE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:UaGhOyXLtqiI5ua1DdO4V8cF+CI=
In-Reply-To: <slrnubd0l6.6tn.ike@iceland.freeshell.org>
 by: Bart - Tue, 18 Jul 2023 13:09 UTC

On 18/07/2023 13:16, Ike Naar wrote:
> On 2023-07-18, Bart <bc@freeuk.com> wrote:
>> On 18/07/2023 03:25, Ben Bacarisse wrote:
>>>>> gcc -std=c11 -pedantic -D_ANSI_SOURCE -fno-common \
>>>>> -fsanitize=undefined -Wbad-function-cast \
>>>>> -Wstrict-prototypes -Wall -Wextra -Wformat-nonliteral
>> -Wcast-align \
>>>>> -Winline -Wundef -Wcast-qual -Wshadow -Wconversion -ffloat-store
>>>>>
>>>>> so I can see problems as early as possible.
>>
>> With your options I managed to still produce an executable for this:
>>
>> int main() {main(1, 2.0, "three", main, main, main();}
>
> How did you manage to produce an executable for that?
> Here, gcc says:
>
> a.c:1:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
> int main() {main(1, 2.0, "three", main, main, main();}
> ^~~~
> a.c: In function 'main':
> a.c:1:53: error: expected ')' before ';' token
> int main() {main(1, 2.0, "three", main, main, main();}
> ^
> a.c:1:54: error: expected ';' before '}' token
> int main() {main(1, 2.0, "three", main, main, main();}
> ^
> and no executable is produced.

There's a typo because I typed it by hand. This is the actual program:

#include <stdio.h>

int main() {
main(1,2.0,"three", main, main, main());
}

All those options will still only warn.

Re: you think rust may outthrone c?

<u965r6$1lnkr$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 14:59:01 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <u965r6$1lnkr$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87v8ehsv2q.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jul 2023 13:59:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c87bb4c669806a0280a3b231e98491a3";
logging-data="1760923"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/vmyHB/4jQA2MPoNcX+lCcWtNdd0EvQqQ="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:fiVMiwBJZ9V+rME7UpbCeTsNZrw=
In-Reply-To: <87v8ehsv2q.fsf@nosuchdomain.example.com>
 by: Bart - Tue, 18 Jul 2023 13:59 UTC

On 18/07/2023 05:27, Keith Thompson wrote:
> Bart <bc@freeuk.com> writes:
> [...]
>> (In the case of Fortran, I remember using machine-specific types such
>> as INTEGER*4 (i32) in 1979; was there anything similar in C before
>> C99?
>>
>> Funny that the non-low-level language had machine types, and
>> close-to-the-metal C didn't!
>
> So your complaint is that C has fixed-width types *now*, but didn't
> acquire them until 24 years ago?

I would dispute that it properly 'acquired' them. What happened is that
someone put a bunch of typedefs and macros into a header, and decreed
that that header is now part of C.

Forget to include that header, and those types don't exist. Meanwhile
format codes and literal suffixes still work with 'long' and 'long long'.

So they were crudely bolted on. You see the effects of it in many
libraries and open source apps that still prefer to define their own
versions despite stdint.h, or on top of stdint.h.

Some compilers may indeed build them in the form of special `__int64`
types for example, but are not allowed to expose those because the
language says it must be done via stdint.h.

Re: you think rust may outthrone c?

<2qxtM.6405$AsA.1422@fx18.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.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: you think rust may outthrone c?
Newsgroups: comp.lang.c
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk> <u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me> <5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com> <b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com> <u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com> <u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk> <u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
Lines: 43
Message-ID: <2qxtM.6405$AsA.1422@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 18 Jul 2023 14:34:38 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 18 Jul 2023 14:34:38 GMT
X-Received-Bytes: 3011
 by: Scott Lurndal - Tue, 18 Jul 2023 14:34 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>Bart <bc@freeuk.com> writes:
>
>
>> OK. But in that case why is C's so-called portability touted so much?
>
>Who touts it? Picking an old version of C, and sticking to the standard
>can result in reasonably portable programs, but the whole notion is
>fraught with misunderstandings and is not easy to define. C is often
>thought of as being very portable because almost every platform has a C
>compiler, but writing highly portable is very hard and few people know
>how to do it well. Does that mean that C is portable or does it mean it
>isn't? The question is not an easy one to answer.

Indeed, it is almost impossible to write a useful application
in portable C. Yes, you can write simple filters using the
primitive and inefficient stdio functionality, but any application
interested in performance will use operating-specific API's
(POSIX, Windows API), which limits the portability of the
application to implementations of those APIs.

>
>> (In the case of Fortran, I remember using machine-specific types such as
>> INTEGER*4 (i32) in 1979; was there anything similar in C before C99?
>
>For a while in the 1970s and into the 80s I would have said that FORTRAN
>66 was probably the most "portable" language around. It was widely
>implemented and had a strict language standard.

I would have said the same about COBOL 68. But even COBOL generally
had implementation specific options and syntax (Burroughs COBOL68
compiler even had inline assembly capability; called "ENTER SYMBOLIC").

>> BTW I can't remember using any options when compiling Fortran.
>
>Really? Odd. I remember needing multiple JCL cards to invoke the IBM
>360 FORTRAN compiler, but you didn't get much choice about the language.

The Burroughs Fortran compilers had $ (in column 1) directives that
selected a number of compile-time options, including selective
compilation. Likewise the other compilers (COBOL, BPL, et alia).

Re: you think rust may outthrone c?

<u9681e$1m5fp$1@dont-email.me>

  copy mid

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

  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: Tue, 18 Jul 2023 16:36:30 +0200
Organization: A noiseless patient Spider
Lines: 91
Message-ID: <u9681e$1m5fp$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 18 Jul 2023 14:36:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="450515ec0877b5b354acbe2c68c4ec4d";
logging-data="1775097"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/BXHfI78D0l4MRAJZZ9K+70b3YNzrrmww="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:fCJHqadHBofvzS4QZJbkiVAkgIo=
Content-Language: en-GB
In-Reply-To: <u95rn3$1k9hq$1@dont-email.me>
 by: David Brown - Tue, 18 Jul 2023 14:36 UTC

On 18/07/2023 13:06, Bart wrote:
>
> On 18/07/2023 03:25, Ben Bacarisse wrote:
> > Bart <bc@freeuk.com> writes:
> >> OK. But in that case why is C's so-called portability touted so much?
> >
> > Who touts it?  Picking an old version of C, and sticking to the standard
> > can result in reasonably portable programs, but the whole notion is
> > fraught with misunderstandings and is not easy to define.  C is often
> > thought of as being very portable because almost every platform has a C
> > compiler, but writing highly portable is very hard and few people know
> > how to do it well.  Does that mean that C is portable or does it mean it
> > isn't?  The question is not an easy one to answer.
>
> So why pick on [criticise] a method of accessing the top bit of a 32-bit
> word that is going to work on all platforms of interest?

Perhaps because it is /not/ going to work on "all platforms of interest"
unless your interest is only in limited poorly optimising tools and in
"it seemed to work when I tried it" coding ?

Do you /still/ not understand? The concern is nothing to do with the
size of "int" and "float" - it is the reliance on /undefined/ behaviour.
Even on compilers which can't do type-based alias analysis, the
behaviour is rarely or never documented - it is /undefined/ because no
one has defined it. And for more serious compilers, you will not get
the results you are imagining because your code makes no sense. It
might all seem to work fine in simple cases, and then fail later in more
advanced use-cases - that's why you want a guarantee that it will work,
because the behaviour is defined and documented.

> What's really going on is that because that method might be tagged as UB
> (/because/ of various obscure architectures where it won't work), we're
> not allowed to use it in cases (perhaps the majority) where there would
> be no problem.

/Please/ try to keep up. The meaning of code in a programming language
is not defined by how it /could/ have been described, but how it is
/actually/ described and specified. C /could/ have been defined to
allow such cross-type accesses to work as though it didn't have a type
system. But it was not so defined - it was defined on the assumption
that people access floats as floats and access ints as ints, and when
they need to do something weird and outside the type system, they write
extra code to make that work safely.

>
> > C has changed quite a bit too
>
> C's changes are minor. Fortran changed from being unstructured, to
> structured, among other major differences.
>
>
> >>> gcc -std=c11 -pedantic -D_ANSI_SOURCE -fno-common \
> >>>       -fsanitize=undefined -Wbad-function-cast \
> >>>       -Wstrict-prototypes -Wall -Wextra -Wformat-nonliteral
> -Wcast-align \
> >>>       -Winline -Wundef -Wcast-qual -Wshadow -Wconversion -ffloat-store
> >>>
> >>> so I can see problems as early as possible.
> >>
> >> So you're using a version of the language defined by those options.
> >
> > That's what every compiler ever written does: process a language defined
> > by the author(s), the options used and the bugs in the implementation.
>
> gcc allows for myriad different dialects, and that's before extensions
> are considered.
>
> My bcc compiler allowed for just two: there was an `-old` switch to
> enable features I didn't want to have, but were necessary to compile
> some existing programs.

Ah, so your compiler is "better" because it is much more limited and
can't handle other people's code?

>
> (One consequence of gcc allowing deprecated features by default is that
> uses of those features are not curtailed; they are perpetuated.)

One of the consequences of having your own personal little compiler is
that no one but you uses it, so in the big picture it is completely
irrelevant. You can put whatever defaults or switches you like, and it
doesn't matter to anyone but you.

One of the consequences of being a major toolchain is that vast numbers
of people use it, and so defaults can't be changed without having big
effects on lots of people and programs.

Re: you think rust may outthrone c?

<u968eh$1m5g5$1@dont-email.me>

  copy mid

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

  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: Tue, 18 Jul 2023 16:43:29 +0200
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <u968eh$1m5g5$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87v8ehsv2q.fsf@nosuchdomain.example.com>
<u95rup$1k9hq$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 18 Jul 2023 14:43:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="450515ec0877b5b354acbe2c68c4ec4d";
logging-data="1775109"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mJKg/onKqUMXf9CRmKSFzB8Y3gmnnB1k="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:ms/NqJdFX4I+kjDJMf4MMgZWO80=
Content-Language: en-GB
In-Reply-To: <u95rup$1k9hq$2@dont-email.me>
 by: David Brown - Tue, 18 Jul 2023 14:43 UTC

On 18/07/2023 13:10, Bart wrote:
> On 18/07/2023 05:27, Keith Thompson wrote:
>> Bart <bc@freeuk.com> writes:
>> [...]
>>> (In the case of Fortran, I remember using machine-specific types such
>>> as INTEGER*4 (i32) in 1979; was there anything similar in C before
>>> C99?
>>>
>>> Funny that the non-low-level language had machine types, and
>>> close-to-the-metal C didn't!
>>
>> So your complaint is that C has fixed-width types *now*, but didn't
>> acquire them until 24 years ago?  It's difficult to imagine any
>> explanation that would satisfy you.
>>
>> And you're referring to the intN_t types as "machine types"?
>> Why do you call them that?
>
> OK, so, N has the values of 8, 16, 32, 64, which by some remarkable
> coincidence are also the bit-widths supported by most current hardware,
> but that doesn't make them machine types?
>

No.

This is comp.lang.c, so we talk about C here. While there is no C term
"machine type", the obvious interpretation of the phrase would be
machine-specific types. That means char, short, int, long, long long -
the types whose precise size and characteristics are machine-dependent.

Types like int32_t are machine /independent/ types - they are the
fixed-size integer types.

I think it is absolutely fine to use the fixed-size types for most code
(though arguably something like int_fast32_t is often a better choice).
But I don't think it is appropriate to call them "machine types".

(To be accurate, the existence of, for example, int32_t is
implementation dependent. But I think any system that doesn't support
that one will be either ancient or extremely niche. Some current
processors don't support 8-bit or 16-bit types, but they are also niche.)

Re: you think rust may outthrone c?

<0e49555d-a456-457e-923e-1950e4e183can@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:240d:b0:765:ab00:9611 with SMTP id d13-20020a05620a240d00b00765ab009611mr119845qkn.3.1689692684140;
Tue, 18 Jul 2023 08:04:44 -0700 (PDT)
X-Received: by 2002:a05:6870:3a15:b0:1ba:5c28:76f1 with SMTP id
du21-20020a0568703a1500b001ba5c2876f1mr9378937oab.4.1689692683865; Tue, 18
Jul 2023 08:04:43 -0700 (PDT)
Path: i2pn2.org!rocksolid2!news.neodome.net!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 18 Jul 2023 08:04:43 -0700 (PDT)
In-Reply-To: <2qxtM.6405$AsA.1422@fx18.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:ac47:d7e:335c:7439;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:ac47:d7e:335c:7439
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk> <u923gr$tf08$1@dont-email.me>
<u92mms$12tmp$1@dont-email.me> <5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com> <u94eb1$1c2vr$1@dont-email.me>
<874jm2tbkt.fsf@nosuchdomain.example.com> <u94hip$1cdbp$1@dont-email.me>
<87lefeukpy.fsf@bsb.me.uk> <u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<2qxtM.6405$AsA.1422@fx18.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0e49555d-a456-457e-923e-1950e4e183can@googlegroups.com>
Subject: Re: you think rust may outthrone c?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 18 Jul 2023 15:04:44 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 24
 by: Malcolm McLean - Tue, 18 Jul 2023 15:04 UTC

On Tuesday, 18 July 2023 at 15:34:56 UTC+1, Scott Lurndal wrote:
> Ben Bacarisse <ben.u...@bsb.me.uk> writes:
> >Bart <b...@freeuk.com> writes:
> >
> >
> >> OK. But in that case why is C's so-called portability touted so much?
> >
> >Who touts it? Picking an old version of C, and sticking to the standard
> >can result in reasonably portable programs, but the whole notion is
> >fraught with misunderstandings and is not easy to define. C is often
> >thought of as being very portable because almost every platform has a C
> >compiler, but writing highly portable is very hard and few people know
> >how to do it well. Does that mean that C is portable or does it mean it
> >isn't? The question is not an easy one to answer.
> Indeed, it is almost impossible to write a useful application
> in portable C. Yes, you can write simple filters using the
> primitive and inefficient stdio functionality, but any application
> interested in performance will use operating-specific API's
> (POSIX, Windows API), which limits the portability of the
> application to implementations of those APIs.
>
The Baby X resource compiler is written in portable C.
It's not. a trivial program.

https://github.com/MalcolmMcLean/babyxrc

Re: you think rust may outthrone c?

<0f51bab5-1b02-416a-9c73-5163587b4571n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:5f96:0:b0:400:aa7b:7a24 with SMTP id j22-20020ac85f96000000b00400aa7b7a24mr88764qta.1.1689696784642;
Tue, 18 Jul 2023 09:13:04 -0700 (PDT)
X-Received: by 2002:a05:6808:1827:b0:3a3:df1d:4369 with SMTP id
bh39-20020a056808182700b003a3df1d4369mr24187302oib.7.1689696784311; Tue, 18
Jul 2023 09:13:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 18 Jul 2023 09:13:03 -0700 (PDT)
In-Reply-To: <u95fct$1ioti$3@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.156; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.156
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>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com> <u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com> <u90u5r$pnad$1@dont-email.me>
<87sf9niqb6.fsf@bsb.me.uk> <u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com> <u94don$1c1k4$1@dont-email.me>
<u95eqh$1ipij$1@dont-email.me> <u95f7s$1ioti$2@dont-email.me> <u95fct$1ioti$3@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0f51bab5-1b02-416a-9c73-5163587b4571n@googlegroups.com>
Subject: Re: you think rust may outthrone c?
From: profesor...@gmail.com (fir)
Injection-Date: Tue, 18 Jul 2023 16:13:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5650
 by: fir - Tue, 18 Jul 2023 16:13 UTC

wtorek, 18 lipca 2023 o 09:36:11 UTC+2 Chris M. Thomasson napisał(a):
> On 7/18/2023 12:33 AM, Chris M. Thomasson wrote:
> > On 7/18/2023 12:26 AM, David Brown wrote:
> >> On 18/07/2023 00:01, Chris M. Thomasson wrote:
> >>> On 7/17/2023 3:01 PM, fir wrote:
> >>>> poniedziałek, 17 lipca 2023 o 08:22:38 UTC+2 David Brown napisał(a):
> >>>>> C is a high level language.
> >>>>
> >>>> i propose to say c is mid-level language.. i would say its closer to
> >>>> low-lewel than high-level
> >>>
> >>> I tend to agree with that.
> >>>
> >>
> >> I don't know if there is any kind of "official" definition of a
> >> high-level language. But I think a reasonable choice would be to say
> >> that a low-level language is one that is defined in terms of the
> >> hardware. Operations in the language do what the hardware says they
> >> will do. A high-level language is one that is defined independently
> >> of any particular hardware.
> >>
> >> By that definition, C is a high-level language - it is defined in
> >> terms of an abstract machine. It has some implementation-dependent
> >> factors (as do all languages - though C has perhaps more than most,
> >> and is more explicit about it than most). But those affect particular
> >> implementations of the language rather than the language itself.
> >>
> >> Another way to distinguish low and high level languages is to consider
> >> the usage, and suitability of usage, in "low level" or "systems"
> >> coding, close to the hardware, as distinct from more abstract coding.
> >> Python is then "high level", with native support for infinite
> >> precision integers, hash maps, standard libraries for
> >> application-level features, etc. C is "low level" for supporting
> >> efficient and direct hardware access and systems coding. But C++
> >> would then be both a low-level /and/ a high-level language.
> >>
> >> I personally think it is more accurate to say that C is a low-level
> >> high-level language, or a high-level language targeting low-level
> >> programming. A binary low/high classification is not particularly
> >> useful - it is perhaps better to think of a scale, in which a language
> >> like Python would be significantly higher than C. But as C would
> >> score well above 0 here, it is very definitely a high level language.
> >
> > Well, I can use C to steal bits from a pointer. Pretty nice and useful,
> > from time to time, so to speak... :^)
> >
> Fun times! Storing meta data in a pointer, then masking it off before we
> actually use the pointer. Undefined behavior for sure, but can it work
> and be used in highly beneficial ways, yup.

its probably bad idea (at least often)
i made such things when coduing my furia (fury) compiler, it was becouse when im
production mkode i hurry much and do what is easiest and most handy, it seem
to be handy in one place to store something in pointer (i dont remember what
for a moment) but soon i regretted it... more worse reverting it now would need few days of work which gives nothing to production (but it would need be done as its just bad)

it work but the code is not clear, yet i in fact has some runtime errors/segfaults which i normally no experience..but overally i was not experienced in writing compilers and did it hack way

Re: you think rust may outthrone c?

<u96gdj$1ndas$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 18 Jul 2023 17:59:30 +0100
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <u96gdj$1ndas$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me> <u9681e$1m5fp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 18 Jul 2023 16:59:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c87bb4c669806a0280a3b231e98491a3";
logging-data="1815900"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eCRmEkv0SXw/ZbrDsfbd2MdZS6uIviMU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:ofxFhC7SZjm+xZ5smMl9SKXOg2c=
In-Reply-To: <u9681e$1m5fp$1@dont-email.me>
 by: Bart - Tue, 18 Jul 2023 16:59 UTC

On 18/07/2023 15:36, David Brown wrote:
> On 18/07/2023 13:06, Bart wrote:

>> My bcc compiler allowed for just two: there was an `-old` switch to
>> enable features I didn't want to have, but were necessary to compile
>> some existing programs.
>
> Ah, so your compiler is "better" because it is much more limited and
> can't handle other people's code?

There are some features that need to be enabled, yes. Is that bad? It
means I can't compile and run my nonsense example without explicitly
enabling it.

>
>>
>> (One consequence of gcc allowing deprecated features by default is
>> that uses of those features are not curtailed; they are perpetuated.)
>
> One of the consequences of having your own personal little compiler is
> that no one but you uses it, so in the big picture it is completely
> irrelevant.  You can put whatever defaults or switches you like, and it
> doesn't matter to anyone but you.

What I'm saying makes sense, and you know it, but won't admit it.

> One of the consequences of being a major toolchain is that vast numbers
> of people use it, and so defaults can't be changed without having big
> effects on lots of people and programs.

The defaults can't be changed, ever?

These compiler have version numbers, and I'm sure people using them
seriously will not rely on defaults.

And if it comes down to it, call the newer version gcc2 or something;
it's really not hard.

The problem is the vast number of people using it casually who will keep
using bad coding styles out of habit, or because they are not admomished
by the compiler.

Then there are the compilers that need to be drop-in replacements for
gcc that now need to replicate every misfeature, down to calling default
output files a.out or a.exe.

Re: you think rust may outthrone c?

<87wmywu1rd.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 19 Jul 2023 02:29:58 +0100
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <87wmywu1rd.fsf@bsb.me.uk>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me>
<87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me>
<874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95ggt$1iuls$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="728d517973707f8d78d2018e7dcfa5fb";
logging-data="1962996"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+l4+DnOv0i3QzZm+Xa+Vw9DmJKmJipaJs="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:kXVpeGsIb23PFKYeT4U7oBuc+AI=
sha1:k8OHGXjFP912OeMaPV20eFtk+hw=
X-BSB-Auth: 1.054fd02d053944c41aa9.20230719022958BST.87wmywu1rd.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 19 Jul 2023 01:29 UTC

David Brown <david.brown@hesbynett.no> writes:

> On 18/07/2023 04:25, Ben Bacarisse wrote:
>> Bart <bc@freeuk.com> writes:
>>
>>> On 18/07/2023 01:28, Ben Bacarisse wrote:
<cut>
>>>> For example, when someone posts here, I will compile it with something
>>>> like this
>>>>
>>>> gcc -std=c11 -pedantic -D_ANSI_SOURCE -fno-common \
>>>> -fsanitize=undefined -Wbad-function-cast \
>>>> -Wstrict-prototypes -Wall -Wextra -Wformat-nonliteral -Wcast-align \
>>>> -Winline -Wundef -Wcast-qual -Wshadow -Wconversion -ffloat-store
>>>>
>>>> so I can see problems as early as possible.
>>>
>>> So you're using a version of the language defined by those options.
>
> Note (this is primarily for Bart - it's nothing new to Ben) that none of
> these flags define the language - they merely ask for warnings on
> suspicious code. "-std=c11" /chooses/ which language standard to use, but
> does not define it.
>
> gcc does offer options that change the language - you can choose to support
> gcc extensions, and you can add additional semantics to C with options such
> as "-fwrapv" and "-fno-strict-aliasing". But those are not in Ben's list.

I may be missing the distinction you are making, but the languages
accepted by gcc -std=c11 and gcc -std=c11 -pedantic are very different!

<cut>
--
Ben.

Re: you think rust may outthrone c?

<87r0p4tyx4.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 19 Jul 2023 03:31:19 +0100
Organization: A noiseless patient Spider
Lines: 95
Message-ID: <87r0p4tyx4.fsf@bsb.me.uk>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me>
<87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me>
<874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="728d517973707f8d78d2018e7dcfa5fb";
logging-data="2099206"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qLxppKLJUqZL/rWDKkPmQLu0L5U7Oc+I="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:FPzY+B4uYc7UrtIEjX0u+gPnZNY=
sha1:zypcQbGlMhliIiruOvbhSLKdcHg=
X-BSB-Auth: 1.4ac9d9989f1086703bb7.20230719033119BST.87r0p4tyx4.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 19 Jul 2023 02:31 UTC

Bart <bc@freeuk.com> writes:

> On 18/07/2023 03:25, Ben Bacarisse wrote:
>> Bart <bc@freeuk.com> writes:
>>> OK. But in that case why is C's so-called portability touted so much?
>>
>> Who touts it? Picking an old version of C, and sticking to the standard
>> can result in reasonably portable programs, but the whole notion is
>> fraught with misunderstandings and is not easy to define. C is often
>> thought of as being very portable because almost every platform has a C
>> compiler, but writing highly portable is very hard and few people know
>> how to do it well. Does that mean that C is portable or does it mean it
>> isn't? The question is not an easy one to answer.
>
> So why pick on [criticise] a method of accessing the top bit of a 32-bit
> word that is going to work on all platforms of interest?

It's getting increasingly hard to believe you don't know. I've
commented before that you and I seem to view programming in entirely
different and incompatible ways, so I suppose it's possible that you
think that some code that worked today is correct (today).

> What's really going on is that because that method might be tagged as UB
> (/because/ of various obscure architectures where it won't work), we're not
> allowed to use it in cases (perhaps the majority) where there would be no
> problem.

It is explicitly stated to be undefined. It's pure spin to say that it
"might be tagged as UB". It's been undefined since ANSI C in 1989.

The /reason/ a construct is undefined has no bearing on my objection to
using it.

You /are/ allowed to use it. The fact that it is undefined simply means
that the definition of the language does not say what the code means.

>> I really don't know what you hope to gain by saying obvious things like
>> this other than to (incorrectly) imply that C -- the language -- is not
>> defined by it's defining documents -- the ISO standards -- but by
>> compiler options.
>
> I've given examples in the past where the same C program either:
>
> * Passed with 0 lines of errors or warnings
>
> * Passed with 28,000 lines of warnings and notes (on a 40Kloc input)

So you are still trying to imply that C -- the language -- is not
defined by it's defining documents -- the ISO standards -- but by
compiler options. You are still wrong.

> I think you're just not seeing it. A compiler should take more
> responsibility for deciding a valid program, or the language should do so
> if it merely leaves things to the implementation.

I have been seeing your stated preferences for years. But what /you/
want from a tool like gcc is not some sacrosanct rule. It's a
preference.

>>>> gcc -std=c11 -pedantic -D_ANSI_SOURCE -fno-common \
>>>> -fsanitize=undefined -Wbad-function-cast \
>>>> -Wstrict-prototypes -Wall -Wextra -Wformat-nonliteral -Wcast-align \
>>>> -Winline -Wundef -Wcast-qual -Wshadow -Wconversion -ffloat-store
>>>>
>>>> so I can see problems as early as possible.
<quoted material re-ordered for clarity>

>> Fortunately, gcc is a quality compiler and these options make the
>> language it accepts as close to ISO standard C (the 2011 version) as I
>> can get it, but there will always be bugs and misunderstandings.
>
> With your options I managed to still produce an executable for this:
>
> int main() {main(1, 2.0, "three", main, main, main());}
<typo corrected>

Are you seriously going to go over this old ground again? I can't
believe you've forgotten, so what do think would be the point of
re-hashing it all again?

> My bcc compiler failed it /unless/ I specified '-old'.

Curious. Why is the program acceptable with that flag but not without?

> Without any options, gcc said nothing about it (a quality compiler
> indeed!).

The tool did what you asked. As it happens, I'd prefer different gcc
defaults as well, but there are just too many scripts, makefiles and
build systems out there that would break. But since providing your own
defaults is easy, I don't really mind much. I certainly would not make
a point if posting about it every few years.

--
Ben.

Re: you think rust may outthrone c?

<20230718230120.629@kylheku.com>

  copy mid

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

  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: Wed, 19 Jul 2023 06:01:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <20230718230120.629@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me> <87r0p4tyx4.fsf@bsb.me.uk>
Injection-Date: Wed, 19 Jul 2023 06:01:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="166ade1046392af984099983cd900df5";
logging-data="2144943"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/z3/4eck+E7cN5sdJ3HTRq+fmiPHdV7fA="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:zTLbxswqFV+SZDj/pOZ88viHDow=
 by: Kaz Kylheku - Wed, 19 Jul 2023 06:01 UTC

On 2023-07-19, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> Bart <bc@freeuk.com> writes:
>> My bcc compiler failed it /unless/ I specified '-old'.
>
> Curious. Why is the program acceptable with that flag but not without?

So that you could have two languages in one, distinguished by
a compiler option.

--
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?

<u982kg$2224b$1@dont-email.me>

  copy mid

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

  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: Wed, 19 Jul 2023 09:16:32 +0200
Organization: A noiseless patient Spider
Lines: 87
Message-ID: <u982kg$2224b$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95ggt$1iuls$1@dont-email.me> <87wmywu1rd.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 19 Jul 2023 07:16:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f6b7c187a8787a0c0cda69b62eec2dcf";
logging-data="2164875"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lVLgXGKBeg1brv2FxVxHAfUnsfs6wO7E="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:fsHfJ4sRz23WLavyoOuWdZVkRGk=
Content-Language: en-GB
In-Reply-To: <87wmywu1rd.fsf@bsb.me.uk>
 by: David Brown - Wed, 19 Jul 2023 07:16 UTC

On 19/07/2023 03:29, Ben Bacarisse wrote:
> David Brown <david.brown@hesbynett.no> writes:
>
>> On 18/07/2023 04:25, Ben Bacarisse wrote:
>>> Bart <bc@freeuk.com> writes:
>>>
>>>> On 18/07/2023 01:28, Ben Bacarisse wrote:
> <cut>
>>>>> For example, when someone posts here, I will compile it with something
>>>>> like this
>>>>>
>>>>> gcc -std=c11 -pedantic -D_ANSI_SOURCE -fno-common \
>>>>> -fsanitize=undefined -Wbad-function-cast \
>>>>> -Wstrict-prototypes -Wall -Wextra -Wformat-nonliteral -Wcast-align \
>>>>> -Winline -Wundef -Wcast-qual -Wshadow -Wconversion -ffloat-store
>>>>>
>>>>> so I can see problems as early as possible.
>>>>
>>>> So you're using a version of the language defined by those options.
>>
>> Note (this is primarily for Bart - it's nothing new to Ben) that none of
>> these flags define the language - they merely ask for warnings on
>> suspicious code. "-std=c11" /chooses/ which language standard to use, but
>> does not define it.
>>
>> gcc does offer options that change the language - you can choose to support
>> gcc extensions, and you can add additional semantics to C with options such
>> as "-fwrapv" and "-fno-strict-aliasing". But those are not in Ben's list.
>
> I may be missing the distinction you are making, but the languages
> accepted by gcc -std=c11 and gcc -std=c11 -pedantic are very different!
>

I was trying to make a distinction between /defining/ a language variant
and /choosing/ a language variant. The language variant you get with
"gcc -std=c11 -pendantic" is not defined by those flags - it is defined
by the ISO standards.

I would also not describe "-std=c11" and "-std=c11 -pendantic" as "very
different" languages or language variants. The "-pedantic" flag makes
gcc give warnings on certain code constructs that were valid in older C
versions but not in C11, and on constraint errors where the standard
requires a diagnostic even though the compiler can generate reasonable
code. But these are warnings, not errors, and the compiler will in many
cases generate warnings on such code even with no flags. (With no std
flag, it defaults to -std=gnu17 on current gcc versions, IIRC.)

"-pedantic-errors" turns many of these warnings into hard errors, so
that it will not compile - that makes the argument of "different
languages" much stronger.

However, I still feel "different" languages is a poor description - even
if you compare "-std=c11 -pedantic-errors" with "-std=gnu11", you are
talking about extensions or additional features - one language is a
subset of the other. Code that is accepted by the compiler with both
flag settings (whether you consider "accepted" to mean accepted without
errors, or accepted without warnings) has the same semantics.

There /are/ gcc flags that actually make the language different, but you
need to pick them specifically. "-fgnu89-inline", for example, will
make the "inline" keyword work like the pre-standardised version that
gcc supported before C99. "-fsigned-char" or "-funsigned-char" will
change the sign of plain "char" to something other than the
ABI-specified choice for the target, which can affect the semantics of
the code.

And there are flags that add additional semantics to the language, but
since the default for these is UB, the default is still a subset -
things like "-fwrapv" and "-ftrapv", and "-fno-strict-aliasing".

So for your list of flags above, consider "-pedantic-errors" rather than
"-pedantic". (For clang fans, clang treats "-pedantic" as
"-pedantic-errors".)

Personally for testing if code is "standard C", I use:

gcc -O2 -std=c17 -Wall -Wextra -Wpedantic

That gives more warnings than required by the standard, but usually they
are an indication of a problem or questionable code, so they are
generally helpful in the context. I enable optimisation because it
enables more code analysis and therefore more warnings.

Re: you think rust may outthrone c?

<u984ba$227l1$1@dont-email.me>

  copy mid

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

  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: Wed, 19 Jul 2023 09:45:46 +0200
Organization: A noiseless patient Spider
Lines: 115
Message-ID: <u984ba$227l1$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8rcu9$qd2$1@dont-email.me> <u8rdrf$uca$1@dont-email.me>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me> <u9681e$1m5fp$1@dont-email.me>
<u96gdj$1ndas$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 19 Jul 2023 07:45:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f6b7c187a8787a0c0cda69b62eec2dcf";
logging-data="2170529"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Pp8emijV1Nu1xiRWBUHbNyvks5JEX5zQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:KSohBq5yM7wFDfifO/Opnsp+0Ts=
In-Reply-To: <u96gdj$1ndas$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Wed, 19 Jul 2023 07:45 UTC

On 18/07/2023 18:59, Bart wrote:
> On 18/07/2023 15:36, David Brown wrote:
>> On 18/07/2023 13:06, Bart wrote:
>
>>> My bcc compiler allowed for just two: there was an `-old` switch to
>>> enable features I didn't want to have, but were necessary to compile
>>> some existing programs.
>>
>> Ah, so your compiler is "better" because it is much more limited and
>> can't handle other people's code?
>
> There are some features that need to be enabled, yes. Is that bad? It
> means I can't compile and run my nonsense example without explicitly
> enabling it.
>

I'm fine with a compiler needing a switch to allow outdated and
dangerous code constructs - that's good. (gcc can't do that, for
historical reasons - it's something you have to do before a tool gets
any widespread use.)

But your compiler won't handle a lot of other modern C constructs, and I
don't see how you view that as an advantage. It's fine if you feel your
compiler is good enough for what you need - but not that it is /better/
because of its limitations.

>>
>>>
>>> (One consequence of gcc allowing deprecated features by default is
>>> that uses of those features are not curtailed; they are perpetuated.)
>>
>> One of the consequences of having your own personal little compiler is
>> that no one but you uses it, so in the big picture it is completely
>> irrelevant.  You can put whatever defaults or switches you like, and
>> it doesn't matter to anyone but you.
>
> What I'm saying makes sense, and you know it, but won't admit it.
>
>> One of the consequences of being a major toolchain is that vast
>> numbers of people use it, and so defaults can't be changed without
>> having big effects on lots of people and programs.
>
> The defaults can't be changed, ever?

Almost correct. Defaults can only be changed very carefully, very
slowly. Debates on the gcc mailing lists come up regularly on this
topic, as many people (including me) think it would be far better if gcc
was much stricter by default. The counter-side is that it is very
important that gcc continue to be able to compile code that it has
always compiled - the value of existing code is enormous. Proposals
have included trying to split the compiler into a "systems" compiler
with few warnings and support for old code, and a "developer" compiler
with stricter checking and more developer help and warnings enabled.
(This would just be done by modifying the default flags depending on the
name used to invoke the compiler - not by having different compilers.)

But it is usually pointed out that any reasonably competent developer
already enables lots of warnings and checks, and uses a build system
that supports that easily (whether it be "make", bash aliases, Windows
bat files, and IDE with options dialog, or whatever.) The kind of
developer that can't or won't use tools to help their work probably
won't pay much attention to the warnings anyway.

Some things do change - "-fno-common" is the default for gcc, since gcc
10 (IIRC). Many things that are outdated are warnings (but not errors)
by default.

>
> These compiler have version numbers, and I'm sure people using them
> seriously will not rely on defaults.
>

That depends on the kind of coding you do.

If you are making code that will be released in source form, you very
much want it to work with default versions on the systems you target -
you want to minimise the requirements for the people using the code. If
you are making binaries, however, you will often want tight control of
the toolchain so that you can make reproducible builds. In between
these extremes, you may want to specify details of compiler flags in the
build setups or instructions.

> And if it comes down to it, call the newer version gcc2 or something;
> it's really not hard.
>

Oh, it really /is/ hard. That's why I said you simply don't understand
the situation there.

To give a car analogy (since these are always popular, until taken too
far), you live on a sparsely populated island with single track roads.
You don't care which side of the road you drive on. But you think it
would be better if the country switched to the right side, because then
you could buy cheaper left-side-drive cars. And you can't understand
why the rest of the UK does not agree with you - surely it's not hard to
change sides, and then everyone could have cheaper cars!

(There was one of the former British colonies in Africa which realised
that switching from left-side drive to right-side drive was too big a
change to do all in one day. So they changed for buses and lorries one
day, and for private cars the week after!)

> The problem is the vast number of people using it casually who will keep
> using bad coding styles out of habit, or because they are not admomished
> by the compiler.
>
> Then there are the compilers that need to be drop-in replacements for
> gcc that now need to replicate every misfeature, down to calling default
> output files a.out or a.exe.

Re: you think rust may outthrone c?

<c52e1506-b0a5-4e5b-99c0-5e79c5305a3an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:4691:b0:767:f7a3:81b4 with SMTP id bq17-20020a05620a469100b00767f7a381b4mr85859qkb.4.1689754747668;
Wed, 19 Jul 2023 01:19:07 -0700 (PDT)
X-Received: by 2002:a05:6808:1529:b0:3a4:1265:312d with SMTP id
u41-20020a056808152900b003a41265312dmr28193547oiw.5.1689754747504; Wed, 19
Jul 2023 01:19:07 -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: Wed, 19 Jul 2023 01:19:07 -0700 (PDT)
In-Reply-To: <87r0p4tyx4.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a5fc:a56:9708:79c3;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a5fc:a56:9708:79c3
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com> <u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com> <u90u5r$pnad$1@dont-email.me>
<87sf9niqb6.fsf@bsb.me.uk> <u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com> <b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk> <u94pch$1dpd6$1@dont-email.me>
<87edl6uf9y.fsf@bsb.me.uk> <u95rn3$1k9hq$1@dont-email.me> <87r0p4tyx4.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c52e1506-b0a5-4e5b-99c0-5e79c5305a3an@googlegroups.com>
Subject: Re: you think rust may outthrone c?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Wed, 19 Jul 2023 08:19:07 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Malcolm McLean - Wed, 19 Jul 2023 08:19 UTC

On Wednesday, 19 July 2023 at 03:31:43 UTC+1, Ben Bacarisse wrote:
> Bart <b...@freeuk.com> writes:
>
> > On 18/07/2023 03:25, Ben Bacarisse wrote:
> >> Bart <b...@freeuk.com> writes:
> >>>
> You /are/ allowed to use it. The fact that it is undefined simply means
> that the definition of the language does not say what the code means.
> >> I really don't know what you hope to gain by saying obvious things like
> >> this other than to (incorrectly) imply that C -- the language -- is not
> >> defined by it's defining documents -- the ISO standards -- but by
> >> compiler options.
> >
> > I've given examples in the past where the same C program either:
> >
> > * Passed with 0 lines of errors or warnings
> >
> > * Passed with 28,000 lines of warnings and notes (on a 40Kloc input)
> So you are still trying to imply that C -- the language -- is not
> defined by it's defining documents -- the ISO standards -- but by
> compiler options. You are still wrong.
>
For someone implementing a compiler, the language is defined by the standards
document. But for someone who is not implementing a compiler, the language
is ultimatelt defined by the behaviour of compilers. Of course if you rely on the
behaviour of the compiler on a construct the standard declares as "undefined
behaviour" then you take the risk that another conforming compiler will behave
differently. But it's not a game changer, because if you rely on defined but obscure
behaviour, you take the risk that a compiler will not be conforming, or that the
standard will be revised.

Re: you think rust may outthrone c?

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

  copy mid

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

  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: Wed, 19 Jul 2023 03:02:14 -0700
Organization: None to speak of
Lines: 24
Message-ID: <87o7k8rzh5.fsf@nosuchdomain.example.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8u3ge$cscl$1@dont-email.me>
<87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me>
<874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me> <87r0p4tyx4.fsf@bsb.me.uk>
<c52e1506-b0a5-4e5b-99c0-5e79c5305a3an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="e77256f1ecfea9cd626451e3e82b5255";
logging-data="2210446"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XdmcS0Eeb0GrC9p2tsJVo"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:9Dfg264fAQnJyGP5TF60RKosk2c=
sha1:tt7gEtSmMr5FCtwlFgSjn7hBfr4=
 by: Keith Thompson - Wed, 19 Jul 2023 10:02 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
[...]
> For someone implementing a compiler, the language is defined by the standards
> document. But for someone who is not implementing a compiler, the language
> is ultimatelt defined by the behaviour of compilers.

I don't agree completely; I see the situation as more symmetric.
I see the standard as a proposed contract between implementers and
users. Neither side is (usually) obligated to accept the contract,
but both sides can choose to do so, and can expect to be able to rely
on the other side to follow the rules. Implementers can provide
non-standard extensions, and users can write code that depends on
those extensions.

An implementation that doesn't at least provide a mode that conforms
to the standard is going to be unpopular, and a programmer who
doesn't know what's guaranteed by the standard and what's specific
to an implementation will have a hard time if they ever want to
use a different implementation.

--
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?

<u98g5n$2469a$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 19 Jul 2023 12:07:35 +0100
Organization: A noiseless patient Spider
Lines: 117
Message-ID: <u98g5n$2469a$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<20230714140153.112@kylheku.com> <u8sf33$4nc3$1@dont-email.me>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95rn3$1k9hq$1@dont-email.me> <87r0p4tyx4.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 19 Jul 2023 11:07:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b65d2679b994ae6bfe4de606f938ae11";
logging-data="2234666"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gALic4HqNSRKSjm4oPAxkZc6XHVJ7qOQ="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:bFIBtMIhjJMDI/5HdkkOBJxF/Do=
In-Reply-To: <87r0p4tyx4.fsf@bsb.me.uk>
 by: Bart - Wed, 19 Jul 2023 11:07 UTC

On 19/07/2023 03:31, Ben Bacarisse wrote:
> Bart <bc@freeuk.com> writes:
>
>> On 18/07/2023 03:25, Ben Bacarisse wrote:
>>> Bart <bc@freeuk.com> writes:
>>>> OK. But in that case why is C's so-called portability touted so much?
>>>
>>> Who touts it? Picking an old version of C, and sticking to the
standard
>>> can result in reasonably portable programs, but the whole notion is
>>> fraught with misunderstandings and is not easy to define. C is often
>>> thought of as being very portable because almost every platform has a C
>>> compiler, but writing highly portable is very hard and few people know
>>> how to do it well. Does that mean that C is portable or does it
mean it
>>> isn't? The question is not an easy one to answer.
>>
>> So why pick on [criticise] a method of accessing the top bit of a 32-bit
>> word that is going to work on all platforms of interest?
>
> It's getting increasingly hard to believe you don't know. I've
> commented before that you and I seem to view programming in entirely
> different and incompatible ways, so I suppose it's possible that you
> think that some code that worked today is correct (today).
>
>> What's really going on is that because that method might be tagged as UB
>> (/because/ of various obscure architectures where it won't work),
we're not
>> allowed to use it in cases (perhaps the majority) where there would
be no
>> problem.
>
> It is explicitly stated to be undefined. It's pure spin to say that it
> "might be tagged as UB". It's been undefined since ANSI C in 1989.

Tell me again what exactly it is that is undefined. Although whatever it
is, I'm likely to disagree that is should be undefined.

Is it accessing an object declared as f32 via an i32* or u32* pointer?

For example (assume both are 32 bits):

float* p = malloc(sizeof(float));

int* q = (void*)(p);

*q; // is it this?

In this case, space for 4 bytes has been allocated. malloc doesn't know
if that space is for floats, ints, or anything else. I genuinely can't
see the problem.

Maybe floats and ints are stored in different kinds of memory in some
peculiar architecture, so that given `float f; int a;`, `&f; &a` are
radically different pointers? (In that case, how are unions of those
even possible?)

Tell me!

Bear in mind that I've created and implemented systems languages for
decades, and have also implemented a version of C. I'm the position of
being able to ensure that such code is well-defined for /my/
implementations on a specified range of targets.

If a C implementation (not mine) decides to seize on UB to make obvious
code do something non-obvious and against the clear intentions of the
programmer, that is not something I would have sympathy with.

>> I've given examples in the past where the same C program either:
>>
>> * Passed with 0 lines of errors or warnings
>>
>> * Passed with 28,000 lines of warnings and notes (on a 40Kloc input)
>
> So you are still trying to imply that C -- the language -- is not
> defined by it's defining documents -- the ISO standards -- but by
> compiler options. You are still wrong.

So the C standard gives no leeway to a compiler in whether a particular
construct in an input should Pass, be given an Warning, or fail with an
Error?

Because it appears to do exactly that here:

int main(void){int a;L:;};

'gcc prog.c` will pass it. With -Wpedantic etc it will show warnings.
And with -Werror too it will fail it.

So, exactly does ISO say should happen? Is it a valid ISO C program or not?

My bcc compiler's C subset passes on the unused `a` and `L` identifiers,
but will report that extraneous ; as an error. You might not agree with
it, but at least it makes its position clear.

Note that my product is a tool to turn source code into binary; it is
not a linter, and it does not give advice.

> Are you seriously going to go over this old ground again? I can't
> believe you've forgotten, so what do think would be the point of
> re-hashing it all again?

Because it is crazy.
>> My bcc compiler failed it /unless/ I specified '-old'.
>
> Curious. Why is the program acceptable with that flag but not without?

My compiler accepts two variations of C for practical reasons. There's
the version I prefer, and the less safe version that is necessary to
build legacy code without needing extensive changes.

I refer to them as 'C' and 'Old C' ('C' is in quotes because the
language I build is non-conforming in many ways.)

Re: you think rust may outthrone c?

<0fa83b40-26e6-427a-ba84-6cf8ac33172an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:1a25:b0:3ff:2517:172 with SMTP id f37-20020a05622a1a2500b003ff25170172mr14578qtb.0.1689766235086;
Wed, 19 Jul 2023 04:30:35 -0700 (PDT)
X-Received: by 2002:a05:6808:23cd:b0:3a3:f0a5:847b with SMTP id
bq13-20020a05680823cd00b003a3f0a5847bmr28542493oib.9.1689766234906; Wed, 19
Jul 2023 04:30:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 19 Jul 2023 04:30:34 -0700 (PDT)
In-Reply-To: <87o7k8rzh5.fsf@nosuchdomain.example.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:e4c9:1be9:910a:4246;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:e4c9:1be9:910a:4246
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8u3ge$cscl$1@dont-email.me> <87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com> <u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com> <u90u5r$pnad$1@dont-email.me>
<87sf9niqb6.fsf@bsb.me.uk> <u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com> <b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me> <874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk> <u94pch$1dpd6$1@dont-email.me>
<87edl6uf9y.fsf@bsb.me.uk> <u95rn3$1k9hq$1@dont-email.me> <87r0p4tyx4.fsf@bsb.me.uk>
<c52e1506-b0a5-4e5b-99c0-5e79c5305a3an@googlegroups.com> <87o7k8rzh5.fsf@nosuchdomain.example.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0fa83b40-26e6-427a-ba84-6cf8ac33172an@googlegroups.com>
Subject: Re: you think rust may outthrone c?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Wed, 19 Jul 2023 11:30:35 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4032
 by: Malcolm McLean - Wed, 19 Jul 2023 11:30 UTC

On Wednesday, 19 July 2023 at 11:02:30 UTC+1, Keith Thompson wrote:
> Malcolm McLean <malcolm.ar...@gmail.com> writes:
> [...]
> > For someone implementing a compiler, the language is defined by the standards
> > document. But for someone who is not implementing a compiler, the language
> > is ultimatelt defined by the behaviour of compilers.
> I don't agree completely; I see the situation as more symmetric.
> I see the standard as a proposed contract between implementers and
> users. Neither side is (usually) obligated to accept the contract,
> but both sides can choose to do so, and can expect to be able to rely
> on the other side to follow the rules. Implementers can provide
> non-standard extensions, and users can write code that depends on
> those extensions.
>
> An implementation that doesn't at least provide a mode that conforms
> to the standard is going to be unpopular, and a programmer who
> doesn't know what's guaranteed by the standard and what's specific
> to an implementation will have a hard time if they ever want to
> use a different implementation.
>
Well for example the standard doesn't guarantee two's complement
representation (or at least didn't, I think it might have changed). So anyone
who relied on that could have seen their code break. But it so unlikely
that it is hardly worth bothering about.

Then to take the current example, I checked and Ben is right. The use of a union
to type pun is "implementation defined". In C. In C++ it's "undefined". Hence my
confusion. But it's not unlikely that C code will be compiled by a C++ compiler.
Now of course you can say "well a C++ compiler compiles a different language,
so all bets are off", but that's being pedantic rather than useful. The fact is
that a C++ compiler is a C compiler which supports the conservative core subset
of the C language, but not necessarily more esoteric features, and you need to
be aware of that if you undertake to write code snippets which will be generally
useful.

Re: you think rust may outthrone c?

<87fs5kt9kn.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 19 Jul 2023 12:38:48 +0100
Organization: A noiseless patient Spider
Lines: 96
Message-ID: <87fs5kt9kn.fsf@bsb.me.uk>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u8u3ge$cscl$1@dont-email.me>
<87sf9oye05.fsf@nosuchdomain.example.com>
<a189a8ff-5e91-43b7-9601-1f29b6a667bfn@googlegroups.com>
<u90c0s$nr2u$1@dont-email.me>
<0ff5dfe1-de32-4dae-872e-5401a3c04c97n@googlegroups.com>
<u90u5r$pnad$1@dont-email.me> <87sf9niqb6.fsf@bsb.me.uk>
<u923gr$tf08$1@dont-email.me> <u92mms$12tmp$1@dont-email.me>
<5fbef78e-14f8-43c4-afaf-17fa5bad12bdn@googlegroups.com>
<b54f60b1-6db7-4ecc-a1f6-b03c78c291een@googlegroups.com>
<u94eb1$1c2vr$1@dont-email.me>
<874jm2tbkt.fsf@nosuchdomain.example.com>
<u94hip$1cdbp$1@dont-email.me> <87lefeukpy.fsf@bsb.me.uk>
<u94pch$1dpd6$1@dont-email.me> <87edl6uf9y.fsf@bsb.me.uk>
<u95ggt$1iuls$1@dont-email.me> <87wmywu1rd.fsf@bsb.me.uk>
<u982kg$2224b$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="728d517973707f8d78d2018e7dcfa5fb";
logging-data="2245575"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LQOnF9h3t6JBjWWarQd/TpwjDCXa1lGU="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:tsS28i0ouE6mY/BQRgRwCoBVoXc=
sha1:+o0OL5gqnj3yRbx0h0xLMJxHn/U=
X-BSB-Auth: 1.e74bc45d3722db581677.20230719123848BST.87fs5kt9kn.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 19 Jul 2023 11:38 UTC

David Brown <david.brown@hesbynett.no> writes:

> On 19/07/2023 03:29, Ben Bacarisse wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>
>>> On 18/07/2023 04:25, Ben Bacarisse wrote:
>>>> Bart <bc@freeuk.com> writes:
>>>>
>>>>> On 18/07/2023 01:28, Ben Bacarisse wrote:
>> <cut>
>>>>>> For example, when someone posts here, I will compile it with something
>>>>>> like this
>>>>>>
>>>>>> gcc -std=c11 -pedantic -D_ANSI_SOURCE -fno-common \
>>>>>> -fsanitize=undefined -Wbad-function-cast \
>>>>>> -Wstrict-prototypes -Wall -Wextra -Wformat-nonliteral -Wcast-align \
>>>>>> -Winline -Wundef -Wcast-qual -Wshadow -Wconversion -ffloat-store
>>>>>>
>>>>>> so I can see problems as early as possible.
>>>>>
>>>>> So you're using a version of the language defined by those options.
>>>
>>> Note (this is primarily for Bart - it's nothing new to Ben) that none of
>>> these flags define the language - they merely ask for warnings on
>>> suspicious code. "-std=c11" /chooses/ which language standard to use, but
>>> does not define it.
>>>
>>> gcc does offer options that change the language - you can choose to support
>>> gcc extensions, and you can add additional semantics to C with options such
>>> as "-fwrapv" and "-fno-strict-aliasing". But those are not in Ben's list.
>> I may be missing the distinction you are making, but the languages
>> accepted by gcc -std=c11 and gcc -std=c11 -pedantic are very different!
>
> I was trying to make a distinction between /defining/ a language variant
> and /choosing/ a language variant. The language variant you get with "gcc
> -std=c11 -pendantic" is not defined by those flags - it is defined by the
> ISO standards.

I am still missing something. How does any flag define a language or
variant rather than just providing a way to choose it?

> I would also not describe "-std=c11" and "-std=c11 -pendantic" as "very
> different" languages or language variants. The "-pedantic" flag makes gcc
> give warnings on certain code constructs that were valid in older C
> versions but not in C11, and on constraint errors where the standard
> requires a diagnostic even though the compiler can generate reasonable
> code.
<cut>
> However, I still feel "different" languages is a poor description - even if
> you compare "-std=c11 -pedantic-errors" with "-std=gnu11", you are talking
> about extensions or additional features - one language is a subset of the
> other. Code that is accepted by the compiler with both flag settings
> (whether you consider "accepted" to mean accepted without errors, or
> accepted without warnings) has the same semantics.

Yes, I thought the problem was one of using terms differently. My
background includes teaching both the formal theory of languages and
introductory programming. This:

int main(void) { return ({0;}); }

is a syntax error in every published version of the C language, right
back to K&R1. Without -pedantic, gcc does not diagnose the syntax
error. Formally, that's accepting a different language, and from the
practical point of view of teaching C, I'd want a student to see a
diagnostic if they wrote that.

> There /are/ gcc flags that actually make the language different, but you
> need to pick them specifically. "-fgnu89-inline", for example, will make
> the "inline" keyword work like the pre-standardised version that gcc
> supported before C99. "-fsigned-char" or "-funsigned-char" will change the
> sign of plain "char" to something other than the ABI-specified choice for
> the target, which can affect the semantics of the code.

Since all we are doing at this point is explaining our terms, I'll just
point out that, to me, C is a language in which the signedness of plain
char is not specified. "-fsigned-char" or "-funsigned-char" specify the
same language. Over the years I've seen both defaults several times, so
now, when I write char, I mentally check that I really mean that. To
me,

char c;

means "let c be char whose signedness I don't care about". For others,
it probably means "let c be a char with native (ABI-defined)
signedness".

> So for your list of flags above, consider "-pedantic-errors" rather than
> "-pedantic".

Obviously I've considered it, but I don't care about the colour of the
diagnostic, and it's actually handy, when compiling code posted here, to
be able to run the executable after reviewing the warnings.

--
Ben.


devel / comp.lang.c / Re: you think rust may outthrone c?

Pages:123456789101112131415161718192021222324252627282930313233343536373839
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor