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.
Thread beginning with comment 43185
To read all comments associated with this story, please click here.
RE: RE: Re: C and portability
by on Tue 11th Oct 2005 12:35 UTC

Member since:


Yet, you cannot write a conforming C/C++ compiler for either. The basic fact is that C makes the assumption that the hardware is unsafe. Higher-level languages make no such assumptions. Since only a subset of machines are unsafe, only a subset are capable of hosting a conforming C compiler, and therefore, C is strictly less portable than a number of other high-level languages.

This argument has so many holes, it borders on nonsense. In no way does C assume a "unsafe" machine, for a start. You are almost sitting in front of the prove: Assume you have a machine which you deemed "safe". Plug this machine to your normal desktop computer (which you call "unsafe") via serial port and the keyboard connector. Let the safe machine just pipe through input and output of the unsafe one. Let your C written program execute on the unsafe machine. The result is a safe machine which can execute a C program. The only remaining "problem" is that the C program might never terminate. I do not know if your definition of a "safe machine" does include that it always terminates. But if it did, it could not run Java either.

By the way, I could make a similar nonsense prove like you did myself. It could go this way: Java assumes a graphic screen to execute, C does not, so Java is strictly less portable than C.

Reply Score: 0