Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 8/23/84; site ucbcad.UUCP Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!ucbcad!faustus From: faustus@ucbcad.UUCP (Wayne A. Christopher) Newsgroups: net.unix-wizards Subject: Re: shorts vs. ints on a VAX 11/750 Message-ID: <73@ucbcad.UUCP> Date: Wed, 17-Jul-85 14:12:05 EDT Article-I.D.: ucbcad.73 Posted: Wed Jul 17 14:12:05 1985 Date-Received: Thu, 18-Jul-85 08:09:12 EDT References: <5161@elsie.UUCP> Organization: UC Berkeley CAD Group, Berkeley, CA Lines: 25 > I noted today that variables in "ex_vis.h" were declared to be type "short" > rather than type "int." Now my own experience with our VAX 11/750 has been > that it pays to declare (non-array) variables to be "int" rather than "short"; > this avoids all sorts of "cvtxx"s at run time, and seems to more than > compensate for the extra memory fetches involved in using "int"s rather > than "short"s. And yet I've got to believe that there was a good reason > for using shorts in vi. Well, there isn't any extra overhead with fetching a long as opposed to a short -- the fetch is always 32 bits. > If you have insights in to using shorts versus using ints on the VAX 11/750 > in general, or shorts versus ints in vi in particular, I'd appreciate hearing > from you. I can think of a few: if you are using a lot of them, then maybe you are concerned with space -- with just a few of them probably that isn't a problem though. Also, in something like vi, which should be pretty portable and was written on a 16-bit machine, it seems like good style to me to be clear about whether you want a variable to have 16 or 32 bits -- an int can be either, depending on what machine you are running on, and you can get used to thinking of an int as 32 bits and get into trouble when it isn't... Wayne