[Top][All Lists]

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

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

From: stevech
Subject: RE: [avr-gcc-list] calling function pointers via pointers ?
Date: Wed, 28 Sep 2005 21:18:11 -0700

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: address@hidden
[mailto:address@hidden On Behalf Of
Joerg Wunsch
Sent: Wednesday, September 28, 2005 12:07 PM
To: address@hidden
Subject: Re: [avr-gcc-list] calling function pointers via pointers ?

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

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

reply via email to

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