5 ms·
How much better or popular would C be if it never had some of its most egregious flaws such as pointer/array decay, unsafe string functions, signed char, switch
by TwoBit 6y ago
How much better or popular would C be if it never had some of its most egregious flaws such as pointer/array decay, unsafe string functions, signed char, switch fallthrough, short/long/int, etc.?
- Hemospectrum 6y agoIt might be better, certainly, but I can’t imagine it would be more popular. Languages ride to popularity on the backs of platforms, either commercial or educational. It has very little to do with their features.
- Snild 6y agoNot much, IMHO (as someone who enjoys writing C). It would still be essentially the same language, and the popularity of other languages -- whether they be C++, rust, python, Java, haskell or whatever -- come from introducing more interesting concepts than that.
- samatman 6y agoI never tire of recommending Evan Buswell's Undefined Intimacy With the Machine[0]. His argument is that it is exactly that undefined behavior and macroassembler nature which allowed C to be be semi-portable, while still allowing for code bumming on very constrained systems. Without all that, C would be, well, Pascal. Which was quite popular for its time, but wasn't used to implement Unix, and didn't become the preferred post-ASM way to write software for microcomputers. [0]: http://thoughtmesh.net/publish/367.php http://thoughtmesh.net/publish/367.php
- Turing_Machine 6y agoThat looked somewhat interesting, but man, my eyes just totally rebelled at the light gray font on a slightly lighter gray background. Especially on a weekend, after too many hours of screen time already this week. Why do people do this? Do they not want people to read their stuff? That kind of thing is fine for a large heading in an Apple ad, but is actively user-hostile for long-form text. Note that Apple itself uses proper text contrast for its long-form documents.
- greenyoda 6y agoI also find web pages like this unreadable. I'd recommend using a browser extension, such as "Dark Reader", to solve this problem. It even lets you adjust contrast/brightness on a per-site basis. It's available for Firefox, Chrome, Edge and Safari. https://darkreader.org https://darkreader.org
- samatman 6y agoI agree with that, there's a printable version with better contrast but then the margins are too wide for my taste: http://thoughtmesh.net/publish/printable.php?id=367 http://thoughtmesh.net/publish/printable.php?id=367 I just put this sort of site through reader mode but it shouldn't be a requirement.
- pjmlp 6y agoIt was used in Lisa and Mac OS, and after MPW introduction, the focus was a mix of Object Pascal and C++, not C. UNIX was written in Assembly, C only came later, as the article clearly states. 8 bits were dominated by Assembly and Basic, in 16 bits we kept using Assembly and a mix of languages, where C was one option among many others.
- Turing_Machine 6y agoPascal is of almost exactly the same vintage, within a year or two, has all the safety features you could want, and yet never really achieved widespread adoption other than as a language for teaching freshman programming. The Pascal dialects that did gain some popularity, such as Borland's Turbo Pascal, generally (I'm tempted to say "always") had non-standard ways to do "unsafe" things. Turbo Pascal, in particular, let you put raw asm right in the middle of your code. "Safe" languages have been invented many times, but programmers always seem to gravitate to powerful, if "dangerous", languages like C and (now) JavaScript. There's probably a lesson for language designers here.
- pjmlp 6y agoThey were standard in ISO Extended Pascal, the standard that mostly ignored because Modula-2, Turbo Pascal and Apple's Object Pascal. Cowboy programming tends to attract certain kinds of developers, but not all.
- Turing_Machine 6y agoI'm not sure that using dismissive pejoratives ("cowboy programmers") is going to shed any useful light on the issue, especially not when the "cowboy" code represents the overwhelming majority of the commercially successful code that has been written in the last 50 years.
- pjmlp 6y agoA network effect caused by UNIX having been made available as free beer OS. When I write C, I write because I am forced to do so due to network effects, and qualitiy is certaintly not something that is part of C's features. And yes, cowboy programming fits the hacker culture that sprung off UNIX, the PHP and JavaScript of the 70's. So apply the same quality considerations to C, that you would measure PHP and JavaScript. Hey, apparently there has been tons of quality software written in PHP and JavaScript as well.
- Turing_Machine 6y ago