[Top][All Lists]

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

Re: [avr-gcc-list] A couple GCC warnings I would like tounderstand/ get

From: Vincent Trouilliez
Subject: Re: [avr-gcc-list] A couple GCC warnings I would like tounderstand/ get rid of...
Date: Sun, 25 Jan 2009 02:11:55 +0100

On Sat, 24 Jan 2009 17:46:35 -0700
"Weddington, Eric" <address@hidden> wrote:

> Which means that you have the NULL and the &menu_sub *reversed* according to 
> your data structure layout, and then on top of this your &menu_sub is the 
> *wrong data*! The structure is looking for a pointer to a function, and you 
> are giving it a pointer to another struct TMenu type.

Oops, I guess I must have confused you somehow (my fault) but I don't
see how my pointers are reversed ? Or maybe my code is unclear. If they
were reversed my program would not work anyhow, as it would try to
call a function (dumy_fnc) instead of displaying a submenu, and
vice-versa, calling a sub menu (menu_sub) when supposed to call the
dummy_fnc() function. 

> The other two lines that I changed, were these:
>       FncPtr = (void (*)(void))(pgm_read_word( & (p->items[0].fptr) ));
>       SubPtr = (const struct TMenu *)(pgm_read_word( & (p->items[0].ptr) ));

Yeah I noticed these were your changes... I did try to put the cast as
it was suggested to me (and by the GCC warning itseld), but
unsurprinsingly I got it wrong, thanks for the help on this !


reply via email to

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