|
|
|
|
|
by gioele
5096 days ago
|
|
Two problems: perfomance and premature abstraction. Using function pointers instead of direct calls one drastically reduces the ability of the compiler to optimise function calls. Second, in most architectures calling a function through a function pointer will incur in a noticeable overhead when compared to a simple function call. But the other problem is premature abstraction. The code is this example is tangled because the "server" has only one "client". In case there were at least one more client to be supported at runtime, it would surely be turned into something similar to what has been suggested. But removing the coupling before you know the similarities and dissimilarities between "clients" can only bring problems. Obviously all this applies only to internal calls, not stable APIs. |
|