Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: integer types Message-ID: <2950@umcp-cs.UUCP> Date: Fri, 1-Feb-85 14:26:12 EST Article-I.D.: umcp-cs.2950 Posted: Fri Feb 1 14:26:12 1985 Date-Received: Sun, 3-Feb-85 09:07:21 EST References: <1997@mordor.UUCP> <631@turtlevax.UUCP> <550@mako.UUCP> <6897@watdaisy.UUCP> Distribution: net Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 30 Actually, there are a couple of different problems to be solved, and subranges don't seem to be the right solution for all of them. 1. You want a variable whose value is to always be contained within some particular range (e.g., array indicies). Subrange types (especially runtime-checked types) are nice. 2. You want a variable whose value can be in *at least* some particular range. Here subrange types that *are not* checked at run time seem to work well (though if there is no checking, calling it a subrange seems misleading, to me). 3. You want a variable whose value is in the largest possible range. Here subranges fail miserably, because you can't write [-infinity..infinity], and even if you could, the machine probably wouldn't support *that* (we won't mention lisp bignums). If you have a ``minint'' and ``maxint'' that might work, but perhaps the machine can (with some speed degradation perhaps) support something bigger than ``integers''. Anyway, subranges have their uses. But since C hasn't got subranges, if you want (1) or (2), use typedefs, preferably in machine-dependent header files. In fact, typedefs will work for (3) also. So why aren't you using them? :-) -- (This line accidently left nonblank.) In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland