avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Strange struct problem


From: Russell Shaw
Subject: Re: [avr-chat] Strange struct problem
Date: Fri, 09 Dec 2005 11:52:06 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.11) Gecko/20050914 Debian/1.7.11-1

Daniel O'Connor wrote:
On Fri, 9 Dec 2005 10:52, Russell Shaw wrote:

Any help gratefully received!

Beware of structure padding leaving holes.

http://www.eskimo.com/~scs/C-faq/q2.12.html
http://www.eskimo.com/~scs/C-faq/q2.13.html

Hmm, I tried..
struct foo { uint8_t a;
        uint8_t b;
        uint8_t c;
        uint8_t d;
        uint8_t e;
    } __attribute__ ((packed)) abc = {
        1,
        2,
        3,
        4,
        5
    };

but there is no change in behaviour.

I would not expect GCC to pad [too much] on AVR anyway because the processor doesn't require aligned access.

Because i haven't got a running system to test it on, i can only infer
things at a distance. I can't see any bugs in the supplied code. Maybe
it's interaction or something being overwritten by another part of your
system?




reply via email to

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