Structures Flashcards
(2 cards)
1
Q
memory allocation
A
In addition to aligning the fields of a record at reasonable offset
boundaries, most compilers will also ensure that the length of the entire
record is a multiple of two, four, or eight bytes. They accomplish this by
adding padding bytes at the end of the record to fill out the record’s size.
2
Q
Manual memory padding
A
type aRecord: packed record bField :byte; padding0 :array[0..2] of byte; (* add padding to dword align wField *) wField :word; padding1 :word; (* add padding to dword align dField *) dField :dword; end;