Hi All,
I was wonder what are relative costs of a function call and a conditional statement? This is because I'm implementing a state machine as:
static media_callback media_cb [EVENT_MAX][STATE_MAX] = { {dummy, media_hide, media_hide, media_hide }, ... };
Should I call the callback like, with dummy function above
media_cb[media_event][media_state](a,b,c,d,e,f);
Or, is introducing a conditional at the point of call the better solution? (& of course replacing dummy with NULL in media_cb array above)
if (media_cb[media_event][media_state] != NULL) media_cb[media_event][media_state](x,y,z);
Regards