Uses of "short" ?

Bill Crews bc at cyb-eng.UUCP
Sat Sep 14 03:49:53 AEST 1985


> Even when writing grubby device driver code, you should use C as a
> higher-level language.  There's no benefit to be gained from thinking of,
> say, the I/O operation/buffer header queue of a disk driver as a bunch of
> words, some of which contain addresses, some of which contain counts, etc..
> The ability of C to get "close to the machine" is vastly overemphasized; 99%
> of the code people write, even in OSes and the like, doesn't need to get
> "close to the machine" in the same sense as an assembler language gets
> "close to the machine" and, in most cases, *doesn't* get "close to the
> machine" in that sense.
> 
> 	Guy Harris

You are invited to write a 3Com Ethernet driver that works on a PC
(16-bit int) and on a Cyb machine (32-bit int) without referring to longs
or shorts.  I.e., a 16-bit hardware register is a 16-bit hardware register,
despite your desire for abstraction.

I doubt we disagree fundamentally; I just think you are stating the case too
strongly.  My goal is to introduce environment dependencies only as needed.
I nevertheless believe, for instance, that when Internet protocol specifies
that the header checksum is a 16-bit 2's-complement number, it is wise to
comply, if you want the packets to fly properly.
-- 
  /  \    Bill Crews
 ( bc )   Cyb Systems, Inc
  \__/    Austin, Texas

[ gatech | ihnp4 | nbires | seismo | ucbvax ] ! ut-sally ! cyb-eng ! bc



More information about the Comp.lang.c mailing list