Unspecified array sizes are a basic no-no on a microprocessor platform. The
compiler strategies have to be simple and explicit, unlike elegant
situations on multi-megabyte big computers.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Joerg Wunsch
Sent: Wednesday, September 28, 2005 12:07 PM
To: avr-gcc-list@nongnu.org
Subject: Re: [avr-gcc-list] calling function pointers via pointers ?

Vincent Trouilliez <[EMAIL PROTECTED]> 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. ;-)



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list




_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to