[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?
From: |
larry barello |
Subject: |
RE: [avr-gcc-list] Typdef chick 'n egg situation.. way out ? |
Date: |
Wed, 21 Jan 2009 16:41:37 -0700 |
You can't make a "flexible" typdef. If you did that the compiler would have
multiple definitions for various instances of the typedef and get horribly
confused.
I have worked around this in several ways:
1. make the typedef array have a size of one.
Allocate some memory to contain the array and assign a pointer of type to
it.
2. Use a #define to create a unique typedef that maps to your basic type but
declares the proper size array.
Both schemes have issues. If there is a better way I would like to know
about it.
I presume C++ handles all this with grace, but I don't really know c++
Finally, I bet there are better forums for this kind of discussion as this
isn't very particular to avr-gcc!
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Vincent Trouilliez
Sent: Wednesday, January 21, 2009 3:59 PM
To: address@hidden
Subject: Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?
On Wed, 21 Jan 2009 10:14:03 -0800
Dean Ferreyra <address@hidden> wrote:
> Vincent Trouilliez wrote:
> > On Wed, 21 Jan 2009 09:33:43 -0800
> > Dean Ferreyra <address@hidden> wrote:
> >
> >> Also, Vince, do you really mean to use a "flexible array" for the
> >> items field; i.e., leaving the size of items unspecified?
> >
> > Yes.. well it's just out of convenience really. When I
> > define/initialise a structure of that type, I just fill it in with
> > whatever number of items a given menu/submenu happens to have, then
> > GCC finds out by itself how many items there are, and sizes the array
> > accordingly.
>
> Sounds good. Just checking! :)
>
> Dean
Dean,
Just realized... now I think of it, regardless of my lazyness, I don't
think I have much choice, I have to make the array size "flexbible" i
nthe structure declaration, since this structure is used to describe
the various menus and sub menus of the menu tree in my user interface,
so obviously all menus have a different number of items in them, so
it's got to be flexible to work !
--
Vince
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
- [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Vincent Trouilliez, 2009/01/21
- RE: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, larry barello, 2009/01/21
- Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Vincent Trouilliez, 2009/01/21
- Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Dean Ferreyra, 2009/01/21
- Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Vincent Trouilliez, 2009/01/21
- Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Dean Ferreyra, 2009/01/21
- Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Vincent Trouilliez, 2009/01/21
- RE: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?,
larry barello <=
- Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Vincent Trouilliez, 2009/01/21
- Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Dave Hylands, 2009/01/21
- RE: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?, Schwichtenberg, Knut, 2009/01/22