What madness is this with a throwing group

I looked at this open source bootloader and I saw this line of code. What happens on the last line? Is it some kind of pointer to a function with a cast to an address?

uint8_t ret = init_api(); uint16_t ptr; ptr = PGM_READ_WORD(JUMP_TABLE_INDEX(6)); ret = ( (uint8_t(*)(uint32_t, uint8_t *, uint8_t)) ptr )(addr, data, erase); 
+5
source share
1 answer

ptr is indexed to a function

 uint8_t f(uint32_t, uint8_t *, uint8_t) 

and the function is called with the addr , data , erase .

+14
source

Source: https://habr.com/ru/post/1238989/


All Articles