[fpc-devel]PowerPC, TypInfo
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Aug 15 11:38:10 CEST 2004
On 15 aug 2004, at 00:20, Florian Klaempfl wrote:
>> To me, the fact that it always reads a longint regardless of the size
>> of the property seems to be inherently wrong. What if the last field
>> of a class is a byte? Then you can read past the end of the class,
>> possibly into unallocated memory causing a crash, no?
>
> No. Classes are always allocated on the heap so the memory block is
> always at least a multiple of 4.
So? What if the last field is a byte and is stored in the last byte of
the e.g. 100 bytes that the class occupies? Keep in mind that
getordprop does not necessarily read from a 4-byte aligned address. It
simply reads 4 bytes from the start address of the field, and then ands
the result with $ff if the size of the field was 1 byte.
Jonas
More information about the fpc-devel
mailing list