[avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
Hi list, Problem: I have two typdef's statement, each type contains a pointer to the other type ! Hmmm typedef TMenuItem struct { chartext[20]; TMenu *ptr; void (*fptr)(); }; typedef TMenu struct { uint8_t nb; char

RE: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread larry barello
Use a struct tag, rather than the typdef tag for your storage type, as: typedef struct _TMenu { ... struct _TMenuItem items[]; } TMenu; typedef struct _TMenuItem { ... struct _TMenu *ptr; ... } MenuItem; -Original Message- Subject: [avr-gcc-list]

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
On Wed, 21 Jan 2009 09:14:39 -0700 larry barello la...@barello.net wrote: Use a struct tag, rather than the typdef tag for your storage type, as: Thanks Larry. -- Vince ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Dean Ferreyra
larry barello wrote: Use a struct tag, rather than the typdef tag for your storage type, as: typedef struct _TMenu { ... struct _TMenuItem items[]; } TMenu; typedef struct _TMenuItem { ... struct _TMenu *ptr; ... } MenuItem; BTW, avr-gcc complains

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
On Wed, 21 Jan 2009 09:33:43 -0800 Dean Ferreyra dferre...@igc.org 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,

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Dean Ferreyra
Vincent Trouilliez wrote: On Wed, 21 Jan 2009 09:33:43 -0800 Dean Ferreyra dferre...@igc.org 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

[avr-gcc-list] Using __tmp_reg__ etc in assembly file

2009-01-21 Thread Colin Wall
Hi List, I must be missing something. I can use symbols like __SREG__, __tmp_reg__ and __zero_reg__ in in-line asm (e.g. push __tmp_reg__) but if I do the same in a pure assembly file, the compiler complains with constant value required. How does one access these symbols in the assembly file

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
On Wed, 21 Jan 2009 10:14:03 -0800 Dean Ferreyra dferre...@igc.org wrote: Vincent Trouilliez wrote: On Wed, 21 Jan 2009 09:33:43 -0800 Dean Ferreyra dferre...@igc.org wrote: Also, Vince, do you really mean to use a flexible array for the items field; i.e., leaving the size of items

Re: [avr-gcc-list] Using __tmp_reg__ etc in assembly file

2009-01-21 Thread Georg-Johann Lay
Colin Wall schrieb: Hi List, I must be missing something. I can use symbols like __SREG__, __tmp_reg__ and __zero_reg__ in in-line asm (e.g. push __tmp_reg__) but if I do the same in a pure assembly file, the compiler complains with constant value required. How does one access these

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
On Wed, 21 Jan 2009 16:41:37 -0700 larry barello la...@barello.net wrote: You can't make a flexible typdef. If you did that the compiler would Ops yes, might be, don't know because to solve my problem I have been suggested to not use Typedef. Dunnon why I wanted to make a Type ouf of my

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Dave Hylands
Hi guys, On Wed, Jan 21, 2009 at 3:41 PM, larry barello la...@barello.net wrote: 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. Actually, with gcc you can. gcc supports the notion