Suppose you have a C or C++-like programming language, but that has good built-in arrays. But you still support pointer math, because systems programmers need that. Should pointer subtraction divide by the size of the pointed-to type, like in C, or
-
-
Hmmmmmm, I had not considered this.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
10°C - 5°C is meaningful (the difference is 5K) even though adding temperatures in °C or pointers isn't meaningful. The situation here is like torsors, where C-style addition is a group action of integers on pointers.
-
Likewise, in math if A and B are points in space then B - A is a vector representing the displacement from A to B. So it's not meaningful to add points (locations in space), but we can take a difference of points to obtain a vector.
- 1 more reply
New conversation -
-
-
There is a case where you can add two points in geometry (or temperatures): (p1+p2)/2 = p1+(p2-p1)/2
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.