Re: Question about GTK+ and timers



On Fri, 8 Apr 2011 16:45:03 -0700
Igor Korot <ikorot01 gmail com> wrote:
> Mikhail,
> 
> On Fri, Apr 8, 2011 at 4:36 PM, 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 .
> 
> My intention is to run the program on the ARM architecture (armv4t) -
> S3C2440 mini2440 device from  FriendlyARM. So I don't think the
> endianess will be the same here.
> I am building everything from the OpenEmbedded tree with the
> arm-angstrom-gnueabi
> gcc compiler.
> 
> What would be the syntax with it?
> 
> [code]
> __attribute__((__packed__))
> struct Data
> {
> .............
> } m_data;
> 
> and what do you mean by swapping the order of the data?
> I am just relying on the cross-compiler to do the right thing for me
> in terms of endianess.
> 
> Should I care about that?

If the machine sending data over the wire has or might have a different
idea of endianness than your ARM architecture receiving it (which
actually is switchable bi-endian I think, but little endian by default),
then you need to care about it.

This might help:

http://en.wikipedia.org/wiki/Endianness

Chris




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