adding pointers

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Jun 8 07:36:01 AEST 1989


In article <9440 at alice.UUCP> ark at alice.UUCP (Andrew Koenig) writes:
>(New York-Washington) + (Boston-New York) is pretty
>clearly equal to (Boston-Washington).

If the distances are measured in a projection plane, then that's exact;
by most measures of difference on the surface of the globe it's only
approximate.  (This doesn't affect the validity of your main point.)

>On the other hand, it does not make geometric sense to add
>two locations.  What, for example, is New York + Boston?
>One could concoct a meaning that would be useful in some cases --
>for example, although I don't know what New York+Boston is,
>I do know what (New York+Boston)/2 is ...

This touches on a topic near to my heart, i.e. the epistemological
foundation for the use of tensors and similar mathematical constructs
in formulating "universal laws" in theoretical physics.  There are
(in general multi-component) quantities sometimes called "holors"
for which several laws of arithmetic are well defined, including
(componentwise) addition and subtraction.  However, not every
mathematical expression involving (components of) holors representing
(aspects of) physical objects itself constitutes (...) a holor
representing (...) a physical object.  Finding operations that
satisfy this constraint is the main business of tensor analysis.

To be more specific, it is often possible to construct a genuine
"tensor" (i.e. a holor with absolute physical significance) out of
non-tensor holors through certain specific arithmetic operations,
although most such expressions would not be tensorial.  For example,
half the difference between the value of the fundamental displacement
field and its transpose is a tensor (i.e. physically significant),
even though the field itself embodies some degree of non-physical
(i.e. conventionally-assigned) properties.  This characteristic is
similar to ARK's example of the average of several locations having
meaning even though arbitrary sums of locations do not.

The relevance to C standardization is that, even though one might
be able to produce meaningful results by certain constrained
combinations of arithmetic operations on pointers, the structure of
the "phrase structure grammar" method of description is such that
we cannot allow "meaningless" intermediate results on the way to
producing a final meaningful value.  If the necessity for broadening
the class of allowed (meaningful) expressions to include (p+q)/2 is
felt strongly enough, the only way it can be achieved is to radically
alter the method currently used to specify the C grammar (along with
constraints and semantics for arithmetic operations).  A vague
statement such as "Any meaningful operation is allowed" is useless
until a tight specification of what is meant by "meaningful".  We
certainly couldn't countenance officially blessing genuinely
meaningless operations without constraints, for a variety of fairly
obvious reasons.

I for one don't see that the need to average pointers is great
enough to justify a complete reorganization of the specification for
arithmetic operators.



More information about the Comp.lang.c mailing list