[fpc-devel] Class field reordering

Martin lazarus at mfriebe.de
Sat Jul 21 18:48:35 CEST 2012


On 14/07/2012 20:46, Jonas Maebe wrote:
> That may actually lead to quite some troubles: if someone recompiles the RTL without optimizations, then your class crackers also have to change that setting. And there's no way to detect how the RTL (or in general: units containing classes you are "cracking") has been compiled in your source code.

Actually there may be:

The cracking unit, needs both cracker classes (with and without 
optimization).

If sizeof(TOptimizedCracker)=sizeof(TTheClass) then
If sizeof(TNotOptimizedCracker)=sizeof(TTheClass) then

This will however not work, if reordering happens for performance.
It could also not work, if the optimizer reorders fields, even if it 
does not save space in the end. (not sure if that can happen).





More information about the fpc-devel mailing list