User:Timo.stripf/Lvalue
Jump to navigation
Jump to search
- LValueToRvalue (ltor) conversion drops qualifiers
- Indirection or array subscript does not perform a memory access. They produce lvalues that perform a memory access during ltor conversion, on the left side of an assign or as part of an ++/-- operator.
- Every array subscript A[i] is equivalent to *(A + i). Without loss of generality, we only discuss indirection in the following document.
- While function designators are not lvalues by the C standard, treating them as pseudo-lvalues in a compiler frontend is a common implementation strategy, as it allows uniform handling of decay and address-taking operations.
- LValueToRvalue casts corresponds to load instructions in LLVM IR
- Expression statements expect rvalue and perform ltor conversion if necessary.
- Use ltor(...), adecay(...), fdecay(...) to highlight implicit casts within the source code. E.g. A[i1][i2] is *(*(A + i1) + i2) is ltor(*(adecay(*(adecay(A) + ltor(i1))) + ltor(i2))) for 2d arrays
- A (char*)A cast for array A is a noop from compiler perspective, since A decays to char* before the cast is applied.