Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site unisoft.UUCP Path: utzoo!watmath!clyde!floyd!harpo!ihnp4!zehntel!hplabs!hpda!fortune!amd70!dual!unisoft!ed From: ed@unisoft.UUCP (Ed Gould) Newsgroups: net.unix-wizards Subject: Re: long vs. int vs. short guidelines (especially for wizards!!) Message-ID: <253@unisoft.UUCP> Date: Tue, 17-Apr-84 02:00:57 EST Article-I.D.: unisoft.253 Posted: Tue Apr 17 02:00:57 1984 Date-Received: Fri, 13-Apr-84 07:56:52 EST References: <430@burl.UUCP> Organization: UniSoft Corp., Berkeley Lines: 18 Actually, there are times that you do want to use int. On some machines, int is faster than short, even though you may need only 16 bits. Int represents the "natural" integer size for the hardware, but it's only guranteed to be at least 16 bits. Use int, therefore, when you don't care about the space consumed and 16 bits is enough (e.g., not in a struct that will be written to a file). As an example of where int might be faster than short, consider a machine with 32-bit registers, but where the 16-bit operations don't clear the upper bits of the register. Usually, the compiler will have to do the manipulation of the upper bits in a separate instruction. -- Ed Gould ucbvax!mtxinu!ed