avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] calling function pointers via pointers ?


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] calling function pointers via pointers ?
Date: Wed, 28 Sep 2005 21:06:57 +0200 (MET DST)

Vincent Trouilliez <address@hidden> wrote:

> What's the trick ?

None.  You cannot have two arrays with unspecified size within the
same object.  The compiler needs to be able to compute the offset of
each struct element at compile-time, and this offset needs to be the
same for each instantiated object of that type.  That way, an array of
unspecified size (i.e. one where the actual memory consumption will
only be determined by the initializer) must be the last element of the
struct as this is the only option to have all struct members at an
identical offset.

You could store a table of strings completely outside the menu
structs, and only have a (still fixed-size) table of pointers to them
inside.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)





reply via email to

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