4 ms·
tl;dr: C is simple. Bad code is bad. Shitty compilers are shitty. This needs to be qualified. Simple compared to what? C is simple when compared to C++, Java,
by dvt 13y ago
tl;dr: C is simple. Bad code is bad. Shitty compilers are shitty.
This needs to be qualified. Simple compared to what? C is simple when compared to C++, Java, and many other languages. Obviously, C is simple because it lacks syntactic sugar, classes, polymorphism, templating (generics), memory management, etc. So, uh, yeah. It's simple.
The fact that bad code can be written in a language doesn't really make the language non-simple. I could write bad code in any language (often times I do!) - so I'm not sure how any judgment about a language can be made with these kinds of examples. As far as the GCC/VC examples are concerned, they are a non-issue. Shitty compiler keywords are shitty[1]. We know. This is one of the many pains of writing cross-platform code in compiled languages. These examples are contrived and I highly doubt most come from production code.
[1] http://stackoverflow.com/questions/3437404/min-and-max-in-c/3437484#3437484 http://stackoverflow.com/questions/3437404/min-and-max-in-c/...
- 14113 13y agoC is simple like the game Go is simple. Both are defined by (comparatively) simple rules, yet the possible situations that both present are far more complex than languages or games defined by far more complex rules.
- kbenson 13y agoIn that vein, assembly languages are even simpler. Which is true. The languages themselves are simple. Their use often isn't.
- aylons 13y agoNo, assembly languages are not simpler, except for a few processors, mostly didactic. Programming in assembly generally requires understanding registers, how the processor works, lots of branching variation, a few other ways to loop, memory organization on the processor, and at least tenths or hundreds of different opcodes, some with surprisingly subtle differences between them. So, no, ASM is not simple the way C is.
- deleted 13y ago[deleted]
- Demiurge 13y agoC is not simple because its BNF is not simple and hard to interpret. You can have a simple (feature wise) C like language with a much cleaner syntax. ie Pascal, Modula, Oberon. You can simplify it a lot just by dropping += :)
- lmm 13y agoSigned/unsigned conversions and conversion to/from pointers of functions and arrays cause real, production-code confusion. In terms of how much mental overhead the language takes up - how many edge cases you have to keep in mind to read code in the language (because if you're programming right then you spend more time reading than writing) - no, it's not simpler than Java, because classes, generics and memory language are more straightforward and less confusing than C's typing rules. Languages have a complexity budget, and C blew its on a squillion different kinds of integer and a bunch of arbitrary-seeming rules to minimize the amount of typing needed to change between them. That was a good tradeoff in its day, where hand-optimization was practical and program source needed to be small. It's not an appropriate language to use now outside of very specific circumstances.
- dvt 13y agoYou say this as if Java doesn't have its fair share of oddities. It seems you're saying that the highly granular typing found in C doesn't have an equally-annoying analogue in Java; it does[1]. [1] http://www.javalobby.org/java/forums/m92125315.html http://www.javalobby.org/java/forums/m92125315.html
- lmm 13y agoThat's not a corner case, it's a particular instance of a general Java misfeature. In Java, "==" is an abomination that you must never use and will give essentially random results; "equals" is what you use to compare things for equality, and this is consistent throughout your codebase. Is it annoying? Yes. But it's easy to remember because it applies everywhere; any case of "==" in a java source file sticks out like a sore thumb. (Also any use of an array, anywhere, for anything. Sometimes I think I should write "Java: the good parts").