Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 v7 ucbtopaz-1.8; site ucbtopaz.CC.Berkeley.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ucbvax!ucbtopaz!mwm From: mwm@ucbtopaz.CC.Berkeley.ARPA Newsgroups: net.lang.c Subject: Re: lint, pointers, 0 (what else?) Message-ID: <766@ucbtopaz.CC.Berkeley.ARPA> Date: Sat, 23-Feb-85 16:37:22 EST Article-I.D.: ucbtopaz.766 Posted: Sat Feb 23 16:37:22 1985 Date-Received: Wed, 27-Feb-85 04:03:24 EST References: <8412@brl-tgr.ARPA> <282@talcott.UUCP> Reply-To: mwm@ucbtopaz.UUCP (Praiser of Bob) Distribution: net Organization: Missionaria Phonibalonica Lines: 32 Summary: In article <282@talcott.UUCP> tmb@talcott.UUCP (Thomas M. Breuel) writes: >> Re: int8, int32, etc. >> Do you also propose int9, int36? int24? float48? >> Let's not embed machine dependencies into the language! > >Some real-life programs require minimal sizes for integers and floating >point numbers. 'int8' should be used as an integer type that holds at >least 8 bits, not as a type that holds exactly 8 bits. > >If your 'C' compiler does not support 32 bit integer precision, but >my differential equations need 32 bit integers, then that is a problem >with your 'C' compiler, not my equations. You pegged int 8 almost exactly (I want it to have 8 bits of magnitude). Likewise, uint10 should be an unsigned holding 10 bits. So, if I need an int that holds -511..511, I should declare it as int9. By leaving out that, you are forcing systems that have 10-bit quantites "naturally" (is BBN still selling them?) to go to the next size you typedef'ed. Conclusion: For any machine/compiler pair, there should be a file that typedefs intX and uintX for all X the machine can use so that you get at least that many bits. X's to big for the system are left undefined. You may want two versions, one optimized for space, and one optimized for speed. As recently suggested, there should also be a point typedef, that is large enough to hold the difference between two pointers. The result of using this system is that you know your programs will get enough space on strange hardware. If it needs things that are too big, it won't compile.