The One True Purpose of C (was Playing with the bits of floats)
Chris Torek
chris at mimsy.UUCP
Sun Jan 22 06:47:01 AEST 1989
In article <284 at bgalli.UUCP> bga at bgalli.UUCP (Billy G. Allie) writes:
>I don't think C was designed for portablility. It was designed to allow a
>reasonably high level language provide adequate access to the underlining
>hardware so that WRITING CODE IN ASSEMBLER WOULD NOT BE NECESSARY. The
>fact that UNIX is written mostly in C says to me that it acheived that
>goal.
I often wonder what Dennis Ritchie thinks of these attempts to stuff
words in his mouth. . . . At any rate, I shall try to speak of what is,
rather than what was meant to be.
>... Portability is a useful goal for programs such as emacs and pcomm,
>but not for an imbedded real-time control system that needs to have good
>response times to external events. For such a project, portability can
>take a flying leap off a high cliff.
Sometimes---but it is well not to throw portability to the wolves, as it
were, until the last. Among other things, it may let you change compilers.
C eliminates much need for assembly coding, but certainly not all. It
is possible to manipulate floating point bit patterns using either unions
or type puns (via address casts). In `traditional' C compilers, this
tends to produce poor code; if it is the central part of such a control
system (although few control systems seem to use floating point), or
has other real-time constraints, you may find that your C compiler
does too poor a job anyway. You then face the choice of replacing or
improving the compiler, or resorting to assembly coding.
(And now for something completely irrelevant:)
>7436 Hartwell, Dearborn, MI 48126
You live almost next door to my older brother (6834). How about that....
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list