Essence of C/C ++ left
(2) which expressions are left and right?
1. Left expression
As described in the previous section, the left value has an object or an incomplete type. In C ++, it also has a function or reference type. However, an expression that does not have the above type is the left value, the key is that the Left value must indicate an object. Whether the object is valid or invalid, complete, or incomplete, it contains functions other than non-static member functions in C ++. For example:
Int I;
Int * P = & I;
Both I and P indicate an object and have an object type, so they are both left values. & I, although it has an object type, is not left because it does not indicate an object.
Incomplete types can also be left values, because incomplete types are essentially the same as object types, but they do not have complete object information. Forward Declaration is the most commonly used incomplete type. The reference to forward declaration is allowed. For example:
Extern struct s;
S & R = s;
Although the complete definition of S is not visible, it can still be used as the left value to initialize the left value reference.