On 8/14/2006 at 12:25 PM der Mouse wrote:
Idiot? Perhaps the code was just written for Unix.
I've written
plenty of code with no attempt to make it portable to non-Unix, or
non-SPARC, or non-VMS, or non-32-bit, or non-whatever. Does that make
me an idiot? Well, perhaps, if such portability should have been
designed in, but absent such a reason, I don't think so.
When it's part of a large product that's meant to be migrated to other
platforms and operating systems and a coder writes in Unix dependecies,
he's an idiot for not realizing that they were, in fact, Unix dependecies.
As I said, I've had my share.
The notion of
a portable C is ridiculous.
Not for suitable values of "portable".
It's not portable to machines that lack the features to support it. There
have been many such machines. Therefore, it's not portable.
C co-evolved with Unix. I don't see this as a
failing of the language;
I see it as a failing of people who not only try to use C on non-Unix
but then proceed to blame C for the inevitable mismatch.
C was devised as a "better than assembly" solution. The original K&R C is
incredibly primitive with various "what this does depends on the guy who
writes the compiler and the machine". Even modern C still has a few of
those. While it may work inside of the Unix context, it's not a general
purpose portable language. FORTRAN (and I'll qualify it by saying the '77
or '66 dialects, or even old USA Basic FORTRAN) is far more portable. I
recall that several micro vendors packaged cross-assemblers as FORTRAN
programs. I had great success on running those just about anywhere without
modification. Just add JCL.
Whatever is necessary to refer to c[52]. By
definition.
If char is smaller than the machine's addressing
granularity, a
pointer-to-char is - must be! - more complicated than a simple memory
address. Figuring out how to handle/avoid such things is part of
building a C implementation for an architecture.
Which can be an absolute nightmare on some architectures. So much for
"almost as good as assembly".
Portable, well, perhaps, if you write in an old enough
dialect.
(Though, again, "portable" immediately raises the question "to
what?".)
How about your PDP-8/L with nothing but an ASR33 attached? Seems that I
remember that it would eat FORTRAN, using paper tape. Will the same setup
also compile C?
Nice? Not really, unless you're doing heavy
numerical code. That's
what FORTRAN was designed for and what it shines at. Like most
languages, it fares rather badly outside its design domain.
Nonsense. I've seen whole operating systems written in FORTRAN. Lawrence
Livermore for years wrote most of their systems code in a dialect of
FORTRAN called LRLTRAN. I believe that several implementations of SNOBOL
were done in it--and I suspect that the same holds true for several
"application specific" languages.
Before a decent C was avilable for CP/M, I was writing data conversion code
in FORTRAN.
One advantage of FORTRAN is that since it lacks an explicit pointer type,
automatic optimization is often more productive than it is on the typical
hunk of C code.
Cheers,
Chuck