[fpc-devel]PowerPC, TypInfo

Florian Klaempfl F.Klaempfl at gmx.de
Sun Aug 15 11:55:03 CEST 2004

Jonas Maebe wrote:

> 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.

Ops :) It seems I worked too much with my sparc ;)

More information about the fpc-devel mailing list