Florian Klaempfl F.Klaempfl at gmx.de
Thu Oct 14 00:15:18 CEST 2004

Marc Weustink wrote:

> At 16:38 13-10-2004, Jonas Maebe wrote:
>> On 12 okt 2004, at 22:12, Marc Weustink wrote:
>>> M:> Is a sigbus catchable so that you can read the data and continue 
>>> as if nothing happened (or is that something at OS level)
>> That is normally possible, yes. But as Florian said, it's quite a bit 
>> of work and also extremely slow (you get 4 context switches per 
>> unaligned access, + the work to load the value).
> Yes I do realize that there is a penalty for doing unaligned access. 

It's not a penalty, it's death regarding speed ;) A solution I could 
imagine is that packed records are accessed correctly, i.e. shifting and 
oring but catching sigbus is too much imo and will cause serious 
performance problems.

BTW: Does anybody have TP 5.5 for m68k and can test what it does :)?

gpc accesses packed records correctly but it doesn't allow to take the 
address of a field of a packed record.

gpc example:

program test;

procedure p(var i : integer);

   r : packed record
     c : char;
     i : integer;

   r.i:=1; <--- works
   p(r.i); <--- test.p:15: packed fields may not be used as `var' parameters

> This will throw away all advantages away form pascal (like strong typing 
> etc).
> And if you forget to make it aligned, you get all kinds of errors.
> I hope I got this all wrong, otherwise I would be better of using a C 
> compiler for this (then I've the ability to use macros to get around this)

FPC always tries to do the best of both worlds, I guess you don't want 
the gpc behaviour either :)

More information about the fpc-devel mailing list