gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] Follow up for bugs reported June 17


From: SiTex Graphics
Subject: Re: [Gm2] Follow up for bugs reported June 17
Date: Wed, 14 Oct 2009 13:49:59 -0400

Hi Iztok,

2009/10/12 Iztok Kobal <address@hidden>:
> SiTex Graphics wrote:
>> Another question:  is there a way to specify the data alignment of a
>> record type?  I have a record that represents a file format on disk
>> which needs an alignment of 1 (ie no pad bytes for any field).
>
> Can you tell me why would you like to create non-portable code?

I'm trying to get existing some existing code to compile and run
correctly under GM2.  In this case I've coded a solution along the
lines you suggest.

-Scott


> Namely,
> 1octet alignment is not natural to any modern microprocessor
> architecture. Furthermore, e.g. ARM architecture can not execute it
> anyway, so compiler can even not be forced to produce 1octet
> field-aligned code.
>
> For my taste, better solution would be object oriented approach with
> field accessor procedures which work on offset basis: copy non-aligned
> character array from some offset to aligned typed variable which
> returns. Such tiny procedures can easily be maintained regarding the
> alignment and endian specifics of any taken architecture.
>
> Iztok
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]