Path: utzoo!utgpu!water!watmath!clyde!ima!compilers-sender From: louie@trantor.umd.edu (Louis A. Mamakos) Newsgroups: comp.compilers Subject: Re: Pointers in C Message-ID: <1329@ima.ISC.COM> Date: 6 Jul 88 04:21:34 GMT References: <1262@ima.ISC.COM> Sender: compilers-sender@ima.ISC.COM Reply-To: louie@trantor.umd.edu (Louis A. Mamakos) Organization: University of Maryland, College Park Lines: 32 Approved: compilers@ima.UUCP i use a compiler which really enforces the rule of comparing (or operating) on two pointers pointing at the same object. The compiler is for a Unisys 1100 mainframe, which is a ones-complement, 36 bit, word addressable machine. This thing is a walking validation test for well written C programs. Its pointers are generally 2 words (8 9-bit bytes) long, except for pointer to functions which are 8 words (64 9-bit bytes) long. Even with all of the obvious adversities, it is not difficult to write C code. You have to watch out for code which thinks that pointers can be put into ints (or longs) and then back again, but other than that, things work. You will also see problems like this, I suspect, on 8086 type segmented architectures. Or so it would seem; I don't use such things. Now, if I can just convince people that -1 <> ~0 you see, on a one's complement computer you have both +0 and -0 and -0 == ~0 Fun stuff. Louis A. Mamakos WA3YMH Internet: louie@TRANTOR.UMD.EDU University of Maryland, Computer Science Center - Systems Programming -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request