On 29 Sep 2005 at 16:20, David Brown wrote:
- Original Message -
From: Vincent Trouilliez [EMAIL PROTECTED]
On Thu, 2005-09-29 at 14:24 +0200, David Brown wrote:
You've picked a chalenge with your complex menu structures, but
you are definitely going about it the right way.
Thank you so much chaps, after an hour experimenting, armed with all
your suggestion, I have now improved my understanding of pointers
again... and it now works...
However, something still causes me trouble apparently
The actual/complete declaration of my menu data type / structure is
From: Vincent Trouilliez [EMAIL PROTECTED]
[...]
Problem: my function pointers are in an array, within a structure, which
itself is accessed via pointers... oh dear.
[...]
//data type for a menu
struct menu {
.;
.;
int (*fp)()[]; //table to store all the pointers
Err...
Joerg Wunsch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
stevech [EMAIL PROTECTED] wrote:
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.
On Thu, 2005-09-29 at 09:25 +0200, David Brown wrote:
It's a little easier to follow than all this void (*fp[])(void) crap,
wouldn't you say?
Thanks for pointing out that my code is crap ! ;-P
I do mean it ! I mean, I am beginner... very motivated and eager to
learn the art, but I can only do
- Original Message -
From: Vincent Trouilliez [EMAIL PROTECTED]
On Thu, 2005-09-29 at 09:25 +0200, David Brown wrote:
It's a little easier to follow than all this void (*fp[])(void) crap,
wouldn't you say?
Thanks for pointing out that my code is crap ! ;-P
I didn't mean it
On Thu, 2005-09-29 at 14:24 +0200, David Brown wrote:
You've picked a chalenge with your complex menu structures, but you are
definitely going about it the right way. Unconstrained arrays are almost
certainly the most elegant way to deal with the structures - when you figure
them out fully,
- Original Message -
From: Vincent Trouilliez [EMAIL PROTECTED]
On Thu, 2005-09-29 at 14:24 +0200, David Brown wrote:
You've picked a chalenge with your complex menu structures, but you are
definitely going about it the right way. Unconstrained arrays are
almost
certainly the
From: Vincent Trouilliez [EMAIL PROTECTED]
[...]
What more could I possibly want ? Well, there is one thing actually:
the pointer points to a function, any function. However if the item is
actually a sub-menu, then the 'menu_item' structure needs to store a
pointer to a 'menu' structure, so that
On Thu, 2005-09-29 at 16:20 +0200, David Brown wrote:
You're getting very close now - don't give up!
David
Thanks again David for the detailed review, and thanks everyone else :-)
The forward declaration did the trick indeed, magic ! :o)
So now the definition of my menus look like this. I
I tried the '' sign, but I get this error:
ui.c:63: warning: initialization discards qualifiers from pointer target
type
I am really lost as to how to specify the address of menu_sub in
ui_menu_main
Well, once I manage to initialise the main menu with the address of the
sub menu,
Vincent Trouilliez wrote:
[...]
ui.c:63: warning: initialization discards qualifiers from pointer target
type
I am really lost as to how to specify the address of menu_sub in
ui_menu_main
OK - I'm going to ask _you_ to do something, just to mix things up here:
1. realise it's a
Hi list,
Another pointer problem again, oops...
I need pointers to functions in my project. Using the great on-line
resource http://www.eskimo.com/~scs/C-faq/q4.12.html which someone on
here mentioned recently, I got the basics working.
But my actual case at hand is a bit trickier and I am lost
Vincent Trouilliez [EMAIL PROTECTED] wrote:
struct menu {
.;
.;
int (*fp)()[]; //table to store all the pointers
};
Better declare them in a prototyped fashion:
int (*fp)(void)[];
//definition for a menu
const struct menu __ATTR_PROGMEM__ menu_foo = {
From: Vincent Trouilliez [EMAIL PROTECTED]
[...]
Problem: my function pointers are in an array, within a structure, which
itself is accessed via pointers... oh dear.
[...]
//data type for a menu
struct menu {
.;
.;
int (*fp)()[]; //table to store all the
On Wed, 28 Sep 2005 14:29:02 +0200, Lars Noschinski
[EMAIL PROTECTED] wrote:
Hi Lars!
In many of my applications I use a called function pointer within an
array in program memory like such example code:
typedef INT8S (*PF_KEYFUNCTION) (MAIN_SYSTEM_STATE_T *ptrSystemState);
PF_KEYFUNCTION
Thank you so much chaps, after an hour experimenting, armed with all
your suggestion, I have now improved my understanding of pointers
again... and it now works...
However, something still causes me trouble apparently
The actual/complete declaration of my menu data type / structure is :
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
From: Vincent Trouilliez [EMAIL PROTECTED]
[...]
However, something still causes me trouble apparently
The actual/complete declaration of my menu data type / structure is :
struct menu {
uint8_t options; //options to control the operation of the menu
uint8_t nb;
: 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
stevech [EMAIL PROTECTED] wrote:
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.
I disagree. Vincent was going to put a table of initialized structs
into
On Wed, 2005-09-28 at 21:18 -0700, stevech wrote:
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.
Thanks chaps, it's a no-no then. I will just move the
Thanks chaps, it's a no-no then. I will just move the strings out of the
structure, or make them fixed size, by setting a limit to the number of
items/options I can have in a menu.
Replying to my post but, since my struct has two arrays, one of strings
and one of pointers, and one of them MUST
23 matches
Mail list logo