[fpc-pascal] Records

Micha Nelissen micha at neli.hopto.org
Wed Oct 26 10:11:04 CEST 2005


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




More information about the fpc-pascal mailing list