Sujet : Re: Python (was Re: I did not inhale)
De : bc (at) *nospam* freeuk.com (Bart)
Groupes : comp.lang.miscDate : 19. Aug 2024, 14:47:39
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9vidr$2spbt$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Mozilla Thunderbird
On 19/08/2024 09:40, David Brown wrote:
On 19/08/2024 09:37, Dmitry A. Kazakov wrote:
The similar process happened with programming languages, e.g. C and with the hardware architectures, e.g. x86. It is always a race to the bottom...
>
The success of the x86 was very much a race to the bottom - it was picked specifically to give a cheaper system rather than the technically superior architecture (m68k) preferred by the engineers. Momentum and backwards compatibility has kept it going ever since.
I am not as convinced with respect to C. It certainly has its flaws, and it certainly has been, and continues to be, used in situations where it is not a good choice of language. But I think much of the bad reputation of C is the result of poor C programmers and poor use of the language, rather than the language itself.
It is the language itself. So many stupid quirks which ended up as indispensible 'features' which meant you had to keep them forever.
Features which, granted that C is generally considered unsafe, just make it stupidly unsafe.
Plus not helped by tooling which insists on allowing ancient, unsafe practices by default so that again, bad habits and uses of unsafe features are perpetuated.
(You of course will insist that such tools must only used with an appropriate set of options to tune the language dialect to safer one.
In that case, you surely wouldn't object to defaulting to a safer dialect and requiring an option to build legacy code.)
Good programmers will write good code in any language, bad programmers (or badly managed programmers) will write bad code in any language.
C makes it considerably easier. I can't reproduce this in my language for example:
int F() {
F(1,2.3,"four",F,F());
}
gcc 14.1.0 passes this by default.
Or this:
void G(int* p) {p[12345];}
int main() {
int i=0;
G(&i);
int (*A)[10];
*(A[i]); // index then deref is valid (this one is wrong)
(*A)[i]; // so is deref then index!
}
Again, gcc 14.1.0 passes it. (If pushed, it will report things like 'statement with no effect' or missing initialisation. I can fix those, but the program is still likely to crash if run.)