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.unix-wizards,net.lang.c Subject: Re: NULL vs 0 - chapter and verse Message-ID: <3472@utzoo.UUCP> Date: Mon, 23-Jan-84 19:36:11 EST Article-I.D.: utzoo.3472 Posted: Mon Jan 23 19:36:11 1984 Date-Received: Mon, 23-Jan-84 19:36:11 EST References: <345@hocda.UUCP> <2406@rabbit.UUCP> <1153@pur-phy.UUCP> <1593@rlgvax.UUCP>, <1158@pur-phy.UUCP> Organization: U of Toronto Zoology Lines: 20 Charles LaBrec observes: Guy however pointed out something about the 32/16 problem that does break the standard--the fact that the subtraction of two pointers produces an int that is the number of elements between the two pointers. I don't see a "portable" way of resolving this difficulty. Lots of fun. In fact, it gets worse. If you have a 32-bit machine that uses all 32 bits for pointers, there may be *no* C data type big enough to hold the difference of two pointers. The difference should clearly be signed (positive or negative depending on whether a > b or a < b), but with 32 bits of pointer an unsigned long is just barely large enough to hold the magnitude, and there's no room for the sign. The ANSI-C-standard people are aware of this one (in fact, I first heard about it from one of them); it's not clear that they can come up with a clean and simple solution. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry