When is a cast not a cast?

Larry Jones scjones at sdrc.UUCP
Sun May 21 04:28:37 AEST 1989


In article <2922 at buengc.BU.EDU>, bph at buengc.BU.EDU (Blair P. Houghton) writes:
> Could it be that adding pointers creates different things, as multiplying
> lengths creates areas?  Maybe.

Yes!  However, adding pointers is more like multiplying areas --
it creates some new thing, but we don't have any word to describe
the result.  Why not?  Probably because most people haven't felt
a need for one -- the result doesn't have any physical analog,
nor does it have any particularly interesting properties (other
than you can reverse the operation to get back what you started
with).

Pointer addition has an additional problem, however.  We know how
to multiply areas because area is represented as a scaler value
and we know how to multiply scalars.  On the other hand, pointers
are NOT scalars and we just don't know how to add them.  At the
risk of attracting snide remarks, let me try yet another analogy:

Dates are pointers to days.  You can add 3 (days) to June 3, 1978
to get June 6, 1978.  You can subtract February 28, 1984 from
March 1, 1984 to get 2 (days).  But how do you add May 10, 1980
to May 20, 1980?
----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones at SDRC.UU.NET
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150-2789             AT&T: (513) 576-2070
"You can't get a body like mine in a bottle --
unless you push REAL HARD." - Judy Tenuta / Dr. Pepper



More information about the Comp.lang.c mailing list