Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!nosc!ucsd!rutgers!uwvax!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: The One True Purpose of C (was Playing with the bits of floats) Message-ID: <15573@mimsy.UUCP> Date: 21 Jan 89 20:47:01 GMT References: <1100@l.cc.purdue.edu> <5586@phoenix.Princeton.EDU> <284@bgalli.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 36 In article <284@bgalli.UUCP> bga@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@mimsy.umd.edu Path: uunet!mimsy!chris