Path: utzoo!mnetor!uunet!mcvax!ukc!its63b!aiva!richard From: richard@aiva.ed.ac.uk (Richard Tobin) Newsgroups: comp.unix.questions Subject: Re: regcmp() Message-ID: <262@aiva.ed.ac.uk> Date: 22 Feb 88 22:04:41 GMT References: <9@vsi.UUCP> <15100006@bucc2> Reply-To: richard@uk.ac.ed.aiva (Richard Tobin) Organization: Bannerman's Bar, Cowgate, Edinburgh Lines: 22 In article <15100006@bucc2> brian@bucc2.UUCP writes: >> Not if you cast it to "char *", it isn't! Passing "(char *)0" is quite >> sufficient, unless the compiler is horribly broken. > Tsk, tsk, tsk. This statment is true if sizeof(int) == sizeof(pointer). It certainly is. It's also true if sizeof(int) != sizeof(pointer). The way you get a null character pointer is by casting 0 to (char *). If a compiler doesn't take (char *)0 to be a null character pointer, it's broken, regardless of the length of pointers. That's just the way it is. Casting 0 to (char *) is *NOT* defined to pretend that zero bit-pattern is a pointer, it's defined to to *convert* 0. The resulting bit pattern can be anything at all (it's often zero). All that matters is that it's always the same, and that no object has it as its address. -- Richard -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nss.cs.ucl.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin