Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What madness is this c group of casts

Tags:

c

casting

I was looking at this open source boot loader and I saw this line of code. What is happening on the last line? Is that 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);
like image 766
confused Avatar asked Dec 22 '15 22:12

confused


People also ask

Is Madness still alive?

Madness are an English ska band from Camden Town, North London, who formed in 1976. One of the most prominent bands of the late 1970s and early 1980s two-tone ska revival, they continue to perform with six of the seven members of their original line-up.

Is madness a cast?

Is Madness Cast from Exile? A card with madness gets discarded into exile. Once there you choose to either cast it or send it to the graveyard. This means that all cards with madness are cast from exile, making the mechanic really good for that Prosper, Tome-Bound deck.

How many No 1's did madness have?

Madness became one of the most charted British groups during the 1980s, with songs such as My Girl, Embarrassment, Our House and their one UK Official Singles Chart Number 1 single House Of Fun. Madness have also scored two UK Official Album Chart Number 1s with the compilations Complete in 1982 and Divine in 1992.


1 Answers

ptr is casted to a pointer to a function

uint8_t f(uint32_t, uint8_t *, uint8_t)

and the function gets called with parameters addr, data, erase.

like image 53
AlexD Avatar answered Sep 18 '22 17:09

AlexD