Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sjuvax.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!psuvax1!burdvax!sjuvax!jss From: jss@sjuvax.UUCP (J. Shapiro) Newsgroups: net.lang.c Subject: Re: SIZEOF Message-ID: <808@sjuvax.UUCP> Date: Wed, 6-Feb-85 03:42:44 EST Article-I.D.: sjuvax.808 Posted: Wed Feb 6 03:42:44 1985 Date-Received: Fri, 8-Feb-85 00:47:08 EST References: <347@ecr.UUCP> <393@rlgvax.UUCP> Organization: Saint Josephs Univ. Phila., Pa. Lines: 34 [Aren't you hungry...?] It occurs to me that the length of a pointer simply being required to be constant (even within the same data type) presents problems. Many microprocessors now implement span-dependent addressing, and if your implementation allows passing of an array wholesale, and that array is small, there is no reason why one shouldn't be able to optimize the pointer size as being relative to some register variable which points to the current function's bottom of passed data. Is this a problem in practice - are pointers in fact obliged to be the same size everywhere, or am I missing something? On the topic of sizeof(int) == sizeof(int *), I refer you to K&R p. 210, which says: 1. A pointer may be converted to any of the integral types long enough to hold it. Whether an int or a long is required is machine dependent. 2. An object of integral type may be explicitly converted to a pointer... Since compilers need to do type checking anyway, passing 0 instead of NULL should always be valid. Note that K&R says that assigning 0 to an integer generates the appropriate NULL pointer. This type conversion (it is implied) is automagic, and thus there *is* a generic NULL, which is the integer 0. It is also mentioned that "The mapping function... is intended to be undsurprising to those who know the addressing structure of the machine," which is a loophole big enough to fly a barn through. Jon Shapiro Haverford College