5 ms·
The declaration syntax and the lack of a proper module/namespacing system is also a mistake, but perhaps not as big as the way arrays decays into pointers. Impl
by neutrono 3y ago
The declaration syntax and the lack of a proper module/namespacing system is also a mistake, but perhaps not as big as the way arrays decays into pointers.
Implicit conversions I suppose could also be classified as a mistake.
- JohnFen 3y agoWhat you're calling "mistakes" look to me like intentional design decisions made in order to optimize for specific kinds of problems. C is not a high level language, nor should it be. If you're doing the sort of work that is better suited for a high level language, then using a different language is the right call.
- neutrono 3y agoWell, IIRC even in the K&R book, a book which many C programmers admire for it's excellent documentation and prose, and rightly so, there is a specific section mentioning that C's declaration syntax has been castigated. Next, even if C is not a "high level language", which depend on your definition of "high level language", the perks of a proper module system for low level coding cannot go unmentioned. - Rust, a language that lives in a somewhat similar abstraction and power space as C, has a module system. - C++, a language that lives closer to C in features, also now, in C++23 I believe, has a module system, and before that, had namespaces. On implicit conversions, I think having implicit conversions are hard to get right, and I think that C has them is not a feature, but rather a bug. Languages that have taken some inspirations from C, has chosen usually to do away with implicit conversions, or at the very least, limit their use. And the array -> pointer in functions, I percieve to be a big mistake, not at the time, perhaps it was not known better ways, but as the years roll by, I think it's a misfeature given the countless exploits that have taken place due to a read past the bounds of an array. I think C is a good language, but these misfeatures burdens the language in an undue way, and I think a better way to design a language is to be more explicit. Something like Rust's unsafe { /* Here be dragons */ } is better design, in my opinion. I think if you want implicit conversions, there should be an explicit way to declare that you want things to be implicit. That's just my 2¢