avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Array of sctructs in flash - getting the address of an el


From: Volker Kuhlmann
Subject: Re: [avr-chat] Array of sctructs in flash - getting the address of an element
Date: Sun, 16 Sep 2012 11:03:29 +1200

On Tue 11 Sep 2012 01:16:12 NZST +1200, Bob von Knobloch wrote:

> struct ctl
>     {
>     char cmdname[10];
>     void* func;
>     char cmdhelp[];

I am not sure what this does in an array, but at best it's allocating
memory sized to fit the largest element for all elements, which is a
waste of space. At worst it's broken, or undefined. You need to make
this a pointer. Try "char * cmdhelp" and change the source where this is
accessed.

Packing the struct makes no difference on 8bit AVR, as with any other
8bit architecture alignment only needs to be byte-wise so packing makes
no sense because everything is already packed anyway.

Volker

-- 
Volker Kuhlmann
http://volker.dnsalias.net/     Please do not CC list postings to me.



reply via email to

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