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 548491
To read all comments associated with this story, please click here.
saso
Member since:
2007-04-18

For me, a languages that allow the developer to focus on the task at hand are always better than those that require them to manipulate every little detail.

Usually that detail manipulation is only required in a very small percentage of the code base.

Essentially what you're describing is limiting freedom in what you can do in a certain language, so that a programmer has no chance of running into trouble. Sometimes it's a good thing, sometimes it's slowing you down. The lack of pointers in Java, for instance, has frequently tied my hands down, e.g. I can't pass a subarray as a zero-cost pointer to a subroutine to work on. Instead, I either have to change the interface to include an offset index, or create a copy (potentially a huge performance penalty if the operation is trivial). If I want to make sure that the callee doesn't modify it, I must copy it. In C, I'd simply make it a pointer to const.

In the end I guess it is a matter of discussing ice cream brands.

Sure is.

Usually static languages with strong typing don't allow for implicit conversion among types, forcing the developers to cast in such cases.
Overflow and underflow are also considered errors, instead of being undefined like in C.
Pointers and arrays are also not compatible, unless you take the base address of the array.
Enumerations are their own type and do not convert implicitly to numeric values, like in C.

All of what you describe are limits on what a developer can do. At times it's sensible to limit them, sometimes it's simply throwing hurdles his or her way. For a CRM system, or a web app, fine, it's sensible not to manipulate pointers - that isn't performance critical code. But not everywhere. I have no problem with you saying 'sometimes/most often these are not necessary'. The problem is when you assert that C is essentially a stupid, pointless language and that everything else that you like is better. I know it's tough to swallow, but there are painfully few OS kernels written in Pascal, and probably for good reason.

Somehow I don't see C listed as a language that supports modules.

That's merely because the author didn't follow his/her own definition. The logical structure of such an argument is:
1) If language X has feature Y, then has support for modular programming
2) Here are the languages I know of that meet criterion 1
All the author did was miss another language that clearly meets their own criteria for modular programming.

For example, in some languages that support modules, the compiler has builtin linker and is also able to check dependencies automatically and only compile required modules.

This is a compiler/build infrastructure feature, not a language feature. For instance, Sun's javac doesn't do that (just tested it), yet Java clearly fits the definition. So for all matters, this is a pointless criterion.

The types are also cross-checked across modules. In C,
some linkers don't complain if the extern definition and the real one don't match.

While it is possible to have poorly written code where interface declarations are completely torn away from their own implementations, the correct practice is to #include your own interface files when making the implementation, exactly to provide this check. Again, your complaint is at least 20 years out of date (this was true in K&R C and other pre-C89 dialects which lacked proper interface declarations).

Reply Parent Score: 3