a line of code has baffled me, , cannot resolve it. casting of function address , assigning function pointer, 'address' should not there. or out of context?
int32_t (*const my_func)(uint32_t address) = (int32_t (*)(uint32_t address)) nvm_addr;
int32_t (*const my_func)(uint32_t address) that variable called my_func stores const pointer function taking uint32_t , returning int32_t. parameter name optional, it's there give idea of semantics of parameter.
(int32_t (*)(uint32_t address)) nvm_addr that casts nvm_addr pointer function of same type my_func.
overall, rather verbose way of storing function pointer nvm_addr.
Comments
Post a Comment