Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: BSD bzero() & NULL Message-ID: <27698@mimsy.umd.edu> Date: 15 Nov 90 12:42:37 GMT References: Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 18 In article jl57+@andrew.cmu.edu (Jay Laefer) asks: >[does char *fred; bzero((char *)&fred, sizeof fred) put a nil pointer to char into `fred'?] >My gut reaction is no because this zeros out a block of memory and I'm >not guaranteed that the computer's internal representation of NULL is a >zero bit pattern. Your reaction is correct. A fair amount of code (not just `BSD' code) assumes that all nil pointers have zero bit patterns; this is one reason the S1 project, which had tagged pointers and was going to use a nonzero bit pattern for nil pointers, eventually gave up and special-cased their C environment to allow all zero bits for nils: it was more work to make things go fast than to make things go like a {VAX, 68000, 80x86, ...}. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris