4 ms·
Asking the C nerds out here... Is that really C's biggest mistake? Edit: I just realised the article was written by D's Author! So maybe that is C's biggest mi
by keyle 3y ago
Asking the C nerds out here... Is that really C's biggest mistake?
Edit: I just realised the article was written by D's Author! So maybe that is C's biggest mistake.
- thechao 3y agoI'm a big C proponent, via C++, I've thought about this article on-and-off since it first came out. My team uses C++ to define new container types & some type-safe translation stuff. If I think about it, our containers are — at their root — fancy fat pointers. So ... yeah ... Walter's right, IMO.
- msla 3y agoA lot of C's flaws are fixed in C++. C++ adds a number of its own flaws, but that's beside the point when discussing C's flaws from a perspective of knowing C++.
- aldanor 3y agoFixed but not enforced (which makes sense given compatibility with C). And that's often the problem, as each next "flaws are now fixed" iteration adds +1 method to do the same thing.
- AnimalMuppet 3y agoC's biggest mistake was originated in 1972 by people trying to create a language for writing operating systems, instead of being originated in 2000 by people trying to create a language that didn't allow you to make the mistakes you could make in C.
- pjmlp 3y agoThose people had plenty of examples since at least JOVIAL in 1958, that they decided to ignore to create they own thing.
- AnimalMuppet 3y agoAnd in following the road they did, they changed the world far more than JOVIAL ever did. C has weaknesses. But it also has strengths, and those strengths mattered. It turns out they mattered more than the set of strengths that JOVIAL had.
- pjmlp 3y agoOnly thanks to having free beer OS. Turns out people will adopt anything that is free, without regards to consequences. Had UNIX been sold under a commercial licence from the get go, it would have been as successful as Plan 9. And thus the world would never suffered from C's existence.
- AnimalMuppet 3y agoYeah, yeah, yeah. C is horrible, and programmers are all idiots because they didn't see how wonderful the stuff you like is. Sure. To steal a line from Jane Austen (or at least a film adaptation), "You tell yourself that, if it gives you comfort." The reality is that your approach didn't meet the needs of the real world as well as the C approach did. You may dislike it, you may resent it, but your way didn't work very well. It's not only because Unix was free, and C came along for the ride. It's also that Multics took several times as long to write, and required bigger hardware. (So Unix would have been cheaper even if the OS was not free, both because of lower cost to write, and because of lower hardware cost for a system to run it on.) And less cost opened up far more possible uses, so it spread quickly and widely. (How many Multics installations were there, ever? Wikipedia says about 80.) Which is better, the language and OS that have flaws, or the language and OS that run on hardware you don't have and can't afford? And Unix was far more portable. Didn't have a PDP-11 either? No worries; it was almost entirely written in C. You could port it to your machine with a C compiler and a little bit of assembly (a very little bit, compared to any other OS). Didn't have C either? It was a small language; it wasn't that hard to write a compiler compared to many other languages. If you were a university, you could implement C and port Unix on your own. But once on university had done so for a particular kind of computer, everyone else could usually use their implementation. And the final nail in the coffin of your style: Programmers of that era preferred that languages get out of their way far more than that languages hold their hand. Your preferred kind of languages failed, because they didn't work with people. It may have worked with the people you wanted to have, but it didn't work with the people that actually existed as programmers at the time. A tool that doesn't fit the people using it is a bad tool. But all is not lost for people like you. There are other languages that fit your preferences, and you can still use them. Just stop expecting them to become mainstream languages. The languages that the majority of programmers found better (for their use) are the languages that won. And that majority was not composed entirely of fools and sheep.
- smackeyacky 3y agoNot by a long shot. The ability to switch between array notation and pointers is fantastic. People crying about it in 2023 is the same as crying about why a 1971 Dodge Challenger doesn't have ABS and airbags.
- sgt 3y agoYou can bolt on airbags and hope it doesn't blow up in your face.
- bryancoxwell 3y agoIf 1971 Dodge Challengers were as ubiquitous as C I would hope people would cry about its lack of ABS and airbags.