[ECOS] Re: pragma pack

EXTERNAL Gladis Olaf (Praktikant; CR/AEM) external.Olaf.Gladis@de.bosch.com
Thu Jan 10 10:07:00 GMT 2008


-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alexandre
Sent: Donnerstag, 10. Januar 2008 10:43
To: Paul D. DeRocco
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Re: pragma pack

> Actually i had some problems accessing my packed structures without
> flows, I think that may help resolve things a bit.
> Eg with things like that:
> cyg_uint8 i = 0;
> struct s_pelco_pattern_array a;
> a.command2_byte = i++;
> a.data3 = i++;
> a.data4 = i++;
> a.timestamp = i;
> I finish having a structure which looks like this in memory:
> cm2: 0x00
> data3: 0x01
> data4: 0x02
> ts: 0x0300
> Which is really not what i want to have eventually.

I would say this looks correct.
Maybe you thought there must be 0x0003 in the last one?

But if you have a little endian CPU it swaps the bytes.
If you have more questions about Endianness take a look at


Greets olaf

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list