Adriaan van Os wrote:
I have never could understand when this is allowed
A1:=A2;

Why this is not allowed
If A1=A2 then

in most Pascal compilers.


Because you can't simply compare the memory ranges occupied by records A and B. They could have different pad bytes (and bits) but still be the same.

Isn't the number of pad bytes a property of a type ? So when two vars are of the same type, they also have the same number of pad bytes ?

Or: the compiler could also do the equivalent of sizeof(a1)=sizeof(a2), if equal then can compare "easy" (same number of pad bytes), otherwise give appropriate error (size of type differs, or so).

Micha

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to