[fpc-devel] FPC_REQUIRES_PROPER_ALIGNMENT

Florian Klaempfl F.Klaempfl at gmx.de
Mon Oct 18 11:00:42 CEST 2004


Marc Weustink wrote:

> 
>> Copy back was already thrown away with Fortran 66 I think because it 
>> caused too much trouble.
> 
> 
> I'll believe it will give troubles in certain situations, I only have no 
> idea where (then again, I'm only a compiler user).
> 
>> r.i could have also an alias so the example above isn't equal to a 
>> direct usage of r.i.
> 
> 
> alias ??

var
    p : plongint;
    i : longint;

...
p:=@i;

> 
> 
>> And keep in mind: the problem is much smaller than you think :) Normal 
>> pascal (without packed, ugly pointer arithmetics or absolute) compiles 
>> fine in 99.99 per cent of all cases. Further, all C/C++ code of e.g. 
>> KDE, GNOME, OpenOffice etc. works on cpus requiring alignment of data 
>> without special compiler tricks, ugly programmer tricks or heavy usage 
>> of memcpy.
> 
> 
> The reason why I started this thread was that I was a bit disappointed 
> that running Lazarus on sparc failed. To apply all kinds of patches and 
> ifdefs for platforms not supporting unaligned access was not an option 
> for me.
> Today I realized that the only sensible use of packed records is when 
> interfacing with external libraries. The chance that this is needed 
> unaligned on a sparc is pretty much zero. So my request for unalinged 
> access makes no sense.
> I'll have a look why packed records are used internally.

That's what I meant: usually, alignment issues are caused only by legacy 
code which uses packed. Newly created code doesn't cause problems usually.





More information about the fpc-devel mailing list