Linked by MOS6510 on Thu 10th Jan 2013 23:25 UTC
General Development "For years I've tried my damnedest to get away from C. Too simple, too many details to manage, too old and crufty, too low level. I've had intense and torrid love affairs with Java, C++, and Erlang. I've built things I'm proud of with all of them, and yet each has broken my heart. They've made promises they couldn't keep, created cultures that focus on the wrong things, and made devastating tradeoffs that eventually make you suffer painfully. And I keep crawling back to C."
Permalink for comment 548336
To read all comments associated with this story, please click here.
tails92
Member since:
2007-10-07

Unlike the other common programming languages of our days, C is the only one expressive enough to do everything you want to do with the machine.
For some it is a strength, for some it is a weakness, but to use C well you need to know how CPUs execute code.
If you know that, aside from syntactical quirks, using C is easy and results in small and fast programs, even in userspace.
Nowadays it is fashionable to criticize C and to say it is not good for userspace applications, but a fact remains and it is that most of the applications which make the computing world run, they are in C. Pure C.
Despite some people thinking otherwise, OOP oriented programming is much more confusing for newbies, and newbies should start learning to programming in assembly. Yes, in assembly. The only way they will understand what the language is doing when they go on to higher level languages. Theory means nothing without practice and understanding. Once you know how assembly languages work and the memory model of machines pointers are just natural.
Substandard programmers can flock to languages like C# or Java. Not that I find Java, the language, wrong in itself, it's just that it is often used by programmers who do not understand what's happening and that want to be cool by saying stuff like "it's secure, it's run by a VM, it's sandbox, it doesn't have pointers!!", well it is does have references. Which, internally, are just like pointers! It's hidden to the eye, but they are still there. Proof is the argument passing to methods in Java, if I pass a reference to an object in an argument, and if I change the value of the reference inside the function at a later moment, the value of the reference I passed to the function externally doesn't change. Just like C. It's still passing argument by copying. Most other things are just things the Java Compiler enforces for you and the JVM sets up automatically for you (like garbage collection, interfaces, etc.).
You can compile C for a virtual machine, and it will be as "safe" as Java run in a virtual machine, and also the MMU already tries to "isolate" user code from system code in order to make things safer. Most times it is sufficient, at times not.
Not type checking adds to the expressiveness of C, it doesn't make it "unsafe" if you know what you are doing. That you can copy things elsewhere without being stopped is a very useful side feature, especially in system code.
Also, C strings are not necessarily too tied to the language. You could modify a C compiler in order to output Pascal-style strings for string constants, and you could make custom string functions that handled Pascal strings if you really wanted to..

Edited 2013-01-11 09:06 UTC

Reply Score: 7