4 ms·
The sleight of hand here is that by leaving so many things undefined, unspecified, and implementation-defined, C gets to foist complexity off on the implementat
by kibwen 2y ago
The sleight of hand here is that by leaving so many things undefined, unspecified, and implementation-defined, C gets to foist complexity off on the implementations and then act as though it's absolved of blame when things go off the rails. The fact that what felt like half of all traffic on Usenet and IRC in the 90s was comprised of people language-lawyering over what is and is not valid C disqualifies it from being considered a simple language. It's as though someone designed a language where the spec is the single sentence "the program does what the user intends it to do" and then held this up pinnacle of simplicity. C has an entire Wikipedia article about how needlessly difficult it is to parse: https://en.m.wikipedia.org/wiki/Lexer_hack https://en.m.wikipedia.org/wiki/Lexer_hack . C has an entire website for helping people interpret its type gibberish: https://cdecl.org/ https://cdecl.org/ . C's string handling is famously broken. C's formatting machinery is Turing complete! Coercions out the wazoo. Switch fallthrough having exactly the wrong default. The fact that Duff's Device works at all. Delegating all abstraction to an infamously error-prone textual macro language. You could spend an entire career learning this language and still find exciting new ways to blow your leg off. If C is our bar for simplicity, it explains a lot about the state of our profession.
- uecker 2y agoI write C every day and wrote C compiler. I know all all the issues it has very well, but it still a relatively simple language. It also not that difficult to parse. The lexer hack is interesting, because you can almost get away with using a context-free lexer, but you need this one hack. But this is not really a problem. People failing to read c declarations is also not the same thing as complexity, although I would agree that those are weird. Null-terminated strings have safety issues, but this is also not the same thing as complexity.
- uecker 2y agoI would argue that the problem of C is something else: It does not provide enough functionality out of the box. So instead of using some safe abstraction, people open-code their string manipulation or buffer management. This is then cumbersome and error prone, leading to complexity of the solution and safety issues which would could easily be avoided.
- sylware 2y agoI prefer a simple computer language with many real-life alternative compilers, and on the long run: the code will be hardened, where appropriate, because it is not cheap, over time. And we must not forget that, 100% "safe" high level code should never be trusted to be compiled into 100% safe machine code.