null pointers [joke?] (was: commom malloc/free practice ...)

Joe English jeenglis at nunki.usc.edu
Sat Oct 28 03:22:11 AEST 1989


bdm659 at csc.anu.oz writes:

>    Section 3.2.2.3 (on the result of casting 0 to a pointer type):
>
>          "Such a pointer, called a null pointer, is guaranteed not to
>           point to any object or function."
>
>    Section 3.3.9 (on pointer equality):
>
>          "If two pointers to object or incomplete types compare equal,
>           they point to the same object."
>
>From these two rules, it logically follows that  (int*)0 != (int*)0 .

Not really; 3.3.9 says (loosely translated)

[(A and B point to an object) and (A == B)] ==> [it is the same object].  
  (1)                             (2)           (3)

If (1) is false it does not follow that (2) is false.
 

--Joe English

  jeenglis at nunki.usc.edu



More information about the Comp.std.c mailing list