Re: Question about GTK+ and timers
- From: Igor Korot <ikorot01 gmail com>
- To: gtk-list gnome org
- Subject: Re: Question about GTK+ and timers
- Date: Fri, 8 Apr 2011 18:08:30 -0700
On Fri, Apr 8, 2011 at 5:02 PM, Chris Vine <chris cvine freeserve co uk> wrote:
> On Fri, 8 Apr 2011 18:36:41 -0500
> "Mikhail Titov" <mlt gmx us> wrote:
>> Just use something like __attribute__ ((__packed__)) for your
>> structure and you can always cast back and forth from the pointer to
>> your structure to an array of bytes (char*). Just make sure that both
>> systems have same ending (little or big) and that members' order is
>> correct. Otherwise you'll have to swap data within let's say
>> m_voltageMask .
> This attribute is compiler specific. He would also have to be careful
> to avoid breaking strict aliasing with his casting, or he could have the
> compiler "optimize" away some of his code. It is relatively easy to
> avoid that (make sure you start with the type you finish with), but I
> am not convinced the OP is necessarily up to speed on how to do it
Yes, this is my first project with an Embedded development. ;-)
> Because this provides unaligned access (on gcc) it can also be
> significantly inefficient on particular architectures.
So, what is the best course of action?
I just tested the program on the device and on x86. On x86 it produced correct
results, whereas on the ARM device it didn't.
So it looks like I will have to switch the endianess when running on the ARM?
No, Chris, what is the best way to do it?
] [Thread Prev