Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!cit-vax!oberon!castor.usc.edu!blarson From: blarson@castor.usc.edu.UUCP Newsgroups: comp.lang.c Subject: Re: Query: Implementation with non-zero NULL Message-ID: <2537@castor.usc.edu> Date: Fri, 5-Jun-87 14:17:32 EDT Article-I.D.: castor.2537 Posted: Fri Jun 5 14:17:32 1987 Date-Received: Sun, 7-Jun-87 01:06:21 EDT References: <158@delftcc.UUCP> <3673@gitpyr.gatech.EDU> <414@sds.UUCP> Reply-To: blarson@castor.usc.edu.UUCP (Bob Larson) Organization: USC AIS, Los Angeles Lines: 28 Keywords: C, NULL, portability In article <414@sds.UUCP> dave@sds.UUCP (dave schmidt x194) writes: >In article <3673@gitpyr.gatech.EDU>, allen@gitpyr.gatech.EDU (P. Allen Jensen) writes: >> [...] The prime also has modes of operation in which >> pointers are 48 bits even though long, int and float are all 32 bits. > >I thought the C language guaranteed that there was an integral type >large enough to hold any pointer type. From p. 210 of the Apocrypha >(== Appendix A of K&R :-) > > A pointer may be converted to any of the integral types > large enough to hold it. Whether an int or long is > required is machine dependent. When a prime CONVERTS a pointer to an integer, the ring (protection) bits are masked off, the segment and halfword offset are left shifted, and the extend bit is moved to the least significant bit. If the assumptions that the C program is running in ring 3 (user mode) and the pointer is pointing to a multiple of 8 bits are true, no information is lost. The only part of K&R this violates is the next sentence after those you quoted: "The mapping function is also machine dependant, but is intended to be unsurprising to those who know the address structure of the machine." Of course, this does help porting programs written by someone making the rash assumption that all machines are byte addressed. -- Bob Larson Arpa: Blarson@Usc-Ecl.Arpa Uucp: (several backbone sites)!sdcrdcf!usc-oberon!castor.usc.edu!blarson seismo!cit-vax!usc-oberon!castor.usc.edu!blarson