Recently, I read the C++ of std::mov, and I thought of a question as the title.
Assume initial value following:
int a= 1;
int b= 2;
I think:
Situation 1,
after move (a <- b):
a= 2 , b=
b is null because moved
Situation 2,
after copy (a <- b):
a=2 , b=2
I know std::move of C++ is Situation 1
Which Situation is mov
( mov %b %a
) of Assembly lang.?
This is my question.
In every architecture I've worked with, a MOV
copies the value, and leaves the source untouched. There's a very simple reasoning for this. Assembly is the "base-level" of what people work with, and needs to be the smallest constituent parts. Therefor, each instruction does as little as it needs to do to get the job done. That way, there's less of a chance of unintended behavior and there are more precise combinations possible.