terminology: "l-value" & "r-value"

Pelle pelle.mansson at gmail.com
Tue Jan 4 06:28:28 PST 2011

On 01/04/2011 02:55 PM, spir wrote:
> Hello,
> I'm bluffed by the 2 terms "l-value"&  "r-value" used in C-line language common terminologies. I think I guess what they mean, but I don't understand the need for such absconse idioms. Why not:
> 	l-value<->  variable
> 	r-value<->  value (or expression)
> ?
> I guess (*p) is considered an l-value. Indeed, it's a special way of denoting a variable, matching the special case of a pointer. If correct, this requires slightly extending the notion of variable (and/or of identifier).
> On the r-value side, I cannot find anything that makes it a distinct concept from the one of value, or of expression.
> Explanations welcome, thank you,
> Denis
> -- -- -- -- -- -- --
> vit esse estrany ☣
> spir.wikidot.com

rvalue is easier than value-not-bound-to-a-memory-address.

lvalue is easier than value-with-memory-address.

Both lvalues and rvalues are values, both can be expressions, and 
lvalues doesn't have to be variables.

Perhaps a better terminology could have been chosen, but changing them 
doesn't provide real benefits, as far as I can tell.

More information about the Digitalmars-d-learn mailing list