Linked by Eugenia Loli on Mon 10th Oct 2005 16:48 UTC, submitted by Shlomi Fish
General Development Shlomi Fish has written a new essay titled "When C is the Best? (Tool for the Job)". Its theme is giving several reasons (besides high speed and low memory consumption) why some code should still be written in C.
Permalink for comment 42916
To read all comments associated with this story, please click here.
The real advantage of C
by Anonymous on Tue 11th Oct 2005 00:17 UTC
Anonymous
Member since:
---

The real advantage of C is that a single C shared library can be used by your C++/Java/Perl/Python/C#/etc. programs, which saves memory and limits security. In other words, C plays nice with other languages.

Try writing a library in Java. Sure, it will be faster to write it in Java than to write it in C. However, it doesn't help someone who wants to do the same functionality in Python; so the Python guy writes a similar library inj Python from scratch. Then the Ruby, Perl, Lisp, etc. people also write independent but similar libraries. You end up with 10 different virtual machines running on you computer, each one doing basically the same thing, but since they cannot share libraries, they take up massively more memory than they ought to. (And no, .net is not an answer -- not if you want to use the .net assembly in a program running on a JVM)

Basically, if you are considering writing a library, <em>write it in C</em>. Or C++ if you really hate C. That way, everyone can use your library, and the world becomes a better place.

Reply Score: 0