Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!pyrnj!mirror!ima!haddock!karl From: karl@haddock.UUCP (Karl Heuer) Newsgroups: comp.unix.wizards Subject: Re: brk's zero-fill behavior on VAXen (useful undefined checks) Message-ID: <160@haddock.UUCP> Date: Tue, 11-Nov-86 21:36:47 EST Article-I.D.: haddock.160 Posted: Tue Nov 11 21:36:47 1986 Date-Received: Wed, 12-Nov-86 21:26:26 EST References: <7208@elsie.UUCP> <5142@brl-smoke.ARPA> <2447@hcr.UUCP> <363@yabbie.rmit.oz> Reply-To: karl@haddock.UUCP (Karl Heuer) Organization: Interactive Systems, Boston Lines: 25 Summary: Sacrificing one value won't always work In article <363@yabbie.rmit.oz> rcodi@yabbie.rmit.oz (Ian Donaldson) writes: >[Initializing to zero is inferior to] a constant garbage value (eg: 0x3e). >Now, if a pointer was to be used that lived in such memory, it would be: >0x3e3e3e3e, a value that will cause most CPU's to give a bus-error or seg >fault, because (1) ... it is an odd-address, A minor quibble here; 0x3e is even. >Perhaps for the sake of run-time checking available with languages such >as Pascal on a 32-bit machine you could sacrifice one state of >the 4G available to be classified as 'undefined'. An obvious state is >[the most negative number on two's complement machines]. Of course, using this value throws away the benefit of having all bytes in the "garbage value" be the same. But anyway... I don't mind losing this value for objects used arithmetically (I don't trust operations on MAXNEG anyway), but you'd have to make an exception for objects used as bit-patterns ("unsigned" in C). (I had problems with this once, using a language that enforced such a "garbage value". I think it was a graphics program, and it turned out to be impossible to draw a certain one-bit pattern.) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint P.S. I like the way VAXen do this with floating point (the result of some operation is NaN, which triggers an FPE on the *next* usage, giving the user a chance to test for it first).