[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] What is the proper cast for reading a table of pointers t
From: |
Bob Paddock |
Subject: |
[avr-gcc-list] What is the proper cast for reading a table of pointers to functions from Flash? |
Date: |
Fri, 20 Jul 2007 15:43:39 -0400 |
User-agent: |
Opera Mail/9.10 (Win32) |
I'm moving some code from 3.4.5 to 4.1.2 and I'm
getting a warning now that I can't figure out the
right way of removing. This was happy in 3.4.5:
state_function_ptr = (void *)
pgm_read_word( &menu_state[current_state_u8].FunctionPointer );
Now generates this warning in 4.1.2:
"ISO C forbids assignment between function pointer and `void *'"
Any other casts I've tried result in different warnings or errors,
and doing nothing tells me I'm assigning an integer to a
pointer with out a cast. :-(
static uint8_t (*state_function_ptr)(void);
typedef struct PROGMEM
{/* Function that will be called based on state table */
uint8_t (*FunctionPointer)(void);
} MENU_STATE;
static uint8_t stf_error( void );
static uint8_t stf_error( void )
{/* We should never reach this state, but if we do display a message to
indicate we got here: */
/* Do something useful here */
return( 0 );
}
static const MENU_STATE menu_state[] PROGMEM = {
/* State Functions: */
{stf_error},
...
};
How do I do this without generating error/warning messages?
- [avr-gcc-list] What is the proper cast for reading a table of pointers to functions from Flash?,
Bob Paddock <=