Assignment type restrictions

As the left and right hand side of an assignment is scalar, what do I, for example, do when I am assigning a pointer to an int? Do I try to convert the types or raise an error? There are no restrictions defined in the reference table.

According to the table 2 in the project specification, you still need to check that

Left side has to be assignable L-value

The 4 rules of assignments in subsection 4.1.3 Additional remarks (in the project specification: page 6) are relevant.

But what is meant with “assignable”? Does it just mean that “it can be assigned to” (e.g. 2+3 cannot be assigned to) or does it mean “RHS can be assigned to LHS” (L/RHS = left/right-hand-side)

It means

For more details, you can find the following in section 4.1.3:

image

1 Like