Thursday, January 12, 2012

Lvalue vs Rvalue

 x=y;

The symbol x here means the address;whereas symbol y means the contents of the address
lvalue is known at complie time and tells where to store the object; whereas an rvalue is not known until runtime.If the value stored in a variable is required, the compiler emits code to read the value from the given address and put it in a register. Generally "value of y" means its rvalue


Modifiable lvalue:An lvalue which is permitted to appear on the left hand side
of an assignment statement.This wierdness is introduced to account for the array names which are lvalues that locate objects,but in C may not be assigned to.Hence an array name is an lvalue but not a modifiable lvalue;The standard says that an assignment operator must have an modifiable lvalue as its left operand i.e.in pure english YOU CAN ONLY ASSIGN INTO THINGS THAT CAN CHANGE.

No comments:

Post a Comment