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: Iztok Kobal
Subject: Re: [Gm2] Follow up for bugs reported June 17
Date: Mon, 12 Oct 2009 09:06:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.23) Gecko/20090912 SUSE/1.1.18-1.1 SeaMonkey/1.1.18

SiTex Graphics wrote:
> Thanks.  I see the same now.
>
> 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).
>
> Thanks,
> Scott
>   
One little question, Scott, if you do not mind.

Can you tell me why would you like to create non-portable code ? 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]