Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.8 $; site ccvaxa Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!preece From: preece@ccvaxa.UUCP Newsgroups: net.lang.c Subject: Re: Uses of "short" ? Message-ID: <2600013@ccvaxa> Date: Tue, 10-Sep-85 11:48:00 EDT Article-I.D.: ccvaxa.2600013 Posted: Tue Sep 10 11:48:00 1985 Date-Received: Thu, 12-Sep-85 10:53:28 EDT References: <486@houxh.UUCP> Lines: 30 Nf-ID: #R:houxh.UUCP:-48600:ccvaxa:2600013:000:1511 Nf-From: ccvaxa.UUCP!preece Sep 10 10:48:00 1985 > There is an unfortunate tendency for C programmers to think in terms of > a concrete machine that they're programming for, rather than an > abstract machine - or, even better, an abstract model of the particular > computation they're performing. Thinking of data objects not as lumps > of machine words but as abstractions will, I suspect, improve the > quality of your code in general, and specifically its portability. /* > Written 12:58 am Sep 6, 1985 by guy@sun.uucp in ccvaxa:net.lang.c */ ---------- But 'int' is a perfectly good abstraction; more abstract that 'short' or 'long.' The restriction of certain values to certain ranges CAN be part of an abstraction, but it can also be an incidental factor that is only useful because some machines make a distinction that makes it useful. That says to me that use of 'short' or 'long' instead of 'int' shows more attention to machine specificity. It may be the case that in a certain piece of code it is possible to prove that a variable's value must lie in a particular range. If the programmer specifies that range somehow, compilers for languages that support that distinction can produce code taking advantage of it. From the programmer's point of view, however, that provable range is probably not significant to her view of the process. Often it doesn't matter to the programmer whether the variable is real or integer, either, but that abstraction is more deeply ingrained. -- scott preece gould/csd - urbana ihnp4!uiucdcs!ccvaxa!preece