Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!cornell!rochester!pt.cs.cmu.edu!andrew.cmu.edu!bob+ From: bob+@andrew.cmu.edu (Bob Sidebotham) Newsgroups: comp.arch Subject: Re: negative addresses Message-ID: <0Wi7Dwy00VsMI4Hkcy@andrew.cmu.edu> Date: 17 Jun 88 01:21:00 GMT References: <2393@uvacs.CS.VIRGINIA.EDU> <21541@amdcad.AMD.COM> <1988May12.162906.16901@utzoo.uucp> <7881@brl-smoke.ARPA> <10001@tekecs.TEK.COM>, <21670@amdcad.AMD.COM> Organization: Carnegie Mellon Lines: 31 In-Reply-To: <21670@amdcad.AMD.COM> > *Excerpts from magazines.software.z: 18-May-88 Re: negative addresses Tim* > *Olson@amdcad.AMD.COM (1494)* > As has been stated in comp.lang.c numerous times: in C, nil can be any > bit pattern, as long as it is guaranteed not to ever point to valid > data. NULL must be 0 (or perhaps (void *)0 under ANSI). The compiler > takes care of the appropriate conversions between NULL and nil. The > above code is correct C. > -- Tim Olson > Advanced Mic I haven't been following this discussion, but I'll add my two-bits worth anyway: my current practice, which is apparently not legal C, is to zero data structures after allocating them, to guarantee the structure is in a reasonable state. This works well for most data types, and, I thought, for pointers. For the moment, I will still consider this a reasonable practice, despite the fact that it may not work on some obscure machines: on the machines I work with, it provides me with a safe way to initialize a data structure which is_ __immune to changes in the definition of the structure._ If I explicitly initialize all of the fields of a structure, someone will later add a field without remembering to add the the corresponding initializing code. It would be preferable to have a C built-in that could be used to intitialize all of a structure's components to "zero" values, and even more preferable if hardware manufacturers, operating system builders, compiler writers, and, of course, language specification writers, all recognized that 0 really is a _very_ special value. Bob Sidebotham P.S. The formatting of this note for the net is beyond my control...