[Lazarus] ARM-WinCE test - DBF
Florian Klaempfl
florian at freepascal.org
Mon May 19 17:59:31 CEST 2008
Joost van der Sluis schrieb:
> Op zaterdag 17-05-2008 om 21:06 uur [tijdzone +0200], schreef
> cc_ at freemail.hu:
>> I probably do not see the depth of the problem, and this seems to be just
>> too easy, but for me this should be done on the compiler level: how about a
>> compiler switch which forces the compiler to "think" as if the "unaligned"
>> keyword was there at the potentially problematic assignments. FPC and
>> Lazarus aims to have a single source for all platforms, and this is broken
>> if you have to change the source for ARM.
>
> Is there an "unaligned" keyword?
Yes.
> What does it do? And how does it helps
> me?
Tell the compiler to access memory location assuming that it is not
aligned naturally:
var
p : plongint;
begin
getmem(p,8);
inc(pointer(p),1);
{ seg. faults: }
p^:=1234;
{ works }
unaligned(p^):=1234;
{ seg. faults }
writeln(p^);
{ works }
writeln(unaligned(p^));
end.
> Remember I told you this:
>
>> ----- Original Message -----
>> From: "Joost van der Sluis" <joost at cnoc.nl>
>>> And the only thing I know about alignment, is that it has something
>> to
>>> do with starting each 'thing' (word, integer, longint) on an
>>> memory-location that could be divided by 2/4/8/whatever.
>>>
>
> Joost
>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
More information about the Lazarus
mailing list