Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP Path: utzoo!watmath!watdaisy!ndiamond From: ndiamond@watdaisy.UUCP (Norman Diamond) Newsgroups: net.lang.c Subject: sizes of pointers Message-ID: <6932@watdaisy.UUCP> Date: Thu, 7-Feb-85 13:42:27 EST Article-I.D.: watdaisy.6932 Posted: Thu Feb 7 13:42:27 1985 Date-Received: Fri, 8-Feb-85 00:23:11 EST Distribution: net Organization: U of Waterloo, Ontario Lines: 28 Two independent ideas here: (1) There still exists a wide variety of machines, including new ones invented almost daily, where registers are not large enough to hold pointers and address arithmetic is non-trivial and you would not want to make sizeof (anytype *) == sizeof (int). You still COULD increase the size of an int so that sizeof (sometypes *) == sizeof (int), but you would regret the waste of space and/or subroutine calls to do all of your int arithmetic. (2) If you want to define some null pointer that's pretty well guaranteed to work, and pass it as a parameter to a subroutine, you can make your null pointer (char *) 0, and make all of your pointer parameters char *'s. Why? Because: calloc returns a char *, and you can always cast the result to convert to any kind of* that you might need. Therefore we know sizeof (char *) >= sizeof (anytype *), for any anytype. Of course, your procedure calls will have to cast all pointer parameters to char *'s, and your procedure code will have to cast them back. -- Norman Diamond UUCP: {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond CSNET: ndiamond%watdaisy@waterloo.csnet ARPA: ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa "Opinions are those of the keyboard, and do not reflect on me or higher-ups."