Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.lang.c Subject: Re: ints vs. pointers Message-ID: <4615@utzoo.UUCP> Date: Sat, 10-Nov-84 21:38:16 EST Article-I.D.: utzoo.4615 Posted: Sat Nov 10 21:38:16 1984 Date-Received: Sat, 10-Nov-84 21:38:16 EST References: <80@physiol.OZ> Organization: U of Toronto Zoology Lines: 14 > [Quoting K&R:] > If two pointers of the same type are subtracted, the result is con- > verted (by division by the length of the object) to an int representing > the number of objects separating the pointed-to objects. > > [Hence pointers cannot be larger than ints.] The explicit use of "int" here is now generally considered a mistake. The ANSI draft (17 Oct 1984 draft) says that the result is a signed integer of implementation-dependent size, i.e. it would be wise to use a long if you need to hold such a result. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry