c standards with regard to pointer behavior
Posted on 2004-03-23
If i have two pointers to structures a and b, like this:
Thing *a, *b;
I can copy the contents of the Thing pointed to by b to a like so:
*a = *b;
(which is basically the same as memcpy (a, b, sizeof(*a))...)
So the question is, what if a and b both point to exact same location? Is the behavior undefined, or should it leave the contents unchanged as you would expect?
I can test it easily, but i want to know if it is guaranteed portable.