|
|
|
|
|
by Jtsummers
1926 days ago
|
|
It's a common pattern in embedded systems (for better or worse) when you have something like function pointers or computed go tos available. C, of course, has function pointers and I've seen dispatch tables like this before: message_handler = {type_0, type_1, ..., type_999}; // imagine it being generated
message_handler[message.type](message);
In the case of computed go to in Fortran, it's similar. I had the "pleasure" of maintaining this once. It's been a while so I had to look up the syntax, IIRC it used something like a dispatch tree and dispatched off each digit in the type but I could be wrong: go to (0, 100, 200, 300, ...), message_type / 100 -- integer division
0
go to ...
100
go to ...
200
go to ...
...
|
|