Link to home
Start Free TrialLog in
Avatar of catbutt
catbutt

asked on

c standards with regard to pointer behavior

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.
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of catbutt
catbutt

ASKER

I'm so impressed with the speed of your answer (2 minutes) that I'll tack on a few more points. :)