What does LHS and RHS mean in C++

In general, LHS and RHS stand for "right hand side" and "left hand side" respectively.So, for example, let's say you have some code that is processing customer addresses and you want to evaluate if two addresses are the same. Somewhere there might be a piece of code that looks like this:

if (Address1 == Address2) { // what happens if they are the same } else { // what happens if they are different }

In this example, "Address1" is on the left-hand side of the evaluation and "Address2" is on the right-hand side of the evaluation. That means that somewhere there also has to be the code that defines your rules for if the two are the same or different - is "IL" equivalent for "Illinois", is "Rob Smith" accepted as the same for "Robert Smith", etc. That code looks something like this:

bool operator== (const Address& lhs, const Address& rhs) { // rules for comparing addresses }

"lhs" and "rhs" are just common abbreviations for the variables that store what was on the left-hand or right-hand side of the original evaluation.

- Brian