Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: An Ubiquitous C bug Message-ID: <14915@smoke.brl.mil> Date: 21 Jan 91 21:09:07 GMT References: Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 21 In article s64421@zeus.usq.EDU.AU (house ron) writes: >In the small memory model, it is possible for a function to have the >address NULL. [Meaning that a pointer to a legitimate function can compare equal to a null pointer constant.] This would be a non-conforming implementation, and one would hope that an example similar to the one you gave is part of any C validation suite. >Perhaps on some machines, NULL should _not_ be 0? No, in the SOURCE CODE, "0" MUST be an allowed way of writing a null pointer constant. This does NOT mean that the compiler has to produce an all 0-bits representation for a null pointer constant, however; it could for example use an all 1-bits representation, or the address of a reserved library object. >After all, it would be easy to prevent functions being >loaded at address 1 (for example) on a DOS machine. That's another solution.