null pointers [joke?]

bdm659 at csc.anu.oz bdm659 at csc.anu.oz
Sun Oct 29 01:54:31 AEST 1989


In article <11432 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
> In article <872.254895b5 at csc.anu.oz> 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 .
>
> Of course this is utter nonsense.  The conclusion does not follow
> from those rules.  (int*)0 is not a pointer to an object or an
> incomplete type.

I didn't say it was.  In fact, I agree it isn't either of those things.
The trouble is that the sentence only requires "pointers to object or
incomplete types", which can only be parsed as "pointers to object types or
pointers to incomplete types".  If it said "objects" instead of "object"
you would have a strong case, but it doesn't, so you don't.

In any case, I could use (void*)0 instead of (int*)0 to avoid this semantic
point, as (void*)0 is certainly a "pointer to incomplete type".

Thus, you are wrong in claiming that the two sentences (AS QUOTED - see my
query at the end) don't imply my conclusion.

However, it turns out that I'M WRONG TOO, for another reason.
Merv Rubinstein informs me that in the draft of Dec. 7 1988 it says

        "If two pointers to object or incomplete
         types are both null, they compare equal."

This proves
 (a) that the phrase "pointers to object or incomplete types" is NOT intended
     to exclude null pointers.  [So much for the "utter nonsense", Doug.]
     Just as well, too, because it would be a pity if we had to give up
     applying 3.2.2.3 and 3.3.4 to them.
 (b) that the difficulty I found in my earlier draft has been already found
     and taken care of.
 (c) that I should wait for my copy of the latest draft to arrive before
     posting articles like that.  (I have a few other "jokes?" up my
     sleeve, but I'll wait until I can argue them with complete knowledge
     of the facts.)

Query:
  Has the sentence from 3.3.9 in the ">" section above been modified to avoid
the contradiction?  (I quoted it from a posting of Bill Wells.  My copy of
the draft is so old that it doesn't have it at all.)
That isn't very important with the new sentence close by, of course, but any
mathematician knows that practically anything can be proved or disproved if
one contradiction is assumed.

Brendan McKay. =============================================================
bdm at anucsd.oz or bdm at anucsd.oz.au    (via uunet.uu.net)



More information about the Comp.std.c mailing list