Top Content Up
Prec

1.4.3 Fiddling with function pointers

Next

This is certainly a solution. Not easier to use. Further, with function pointer, you must find a way to carry context information. The function is called potentially from another function located at the far right of the graph, knowing almost nothing about the application.

One solution to the context problem is the "void pointer" that function pass around so it can be passed to the supplied function which can cast back to the proper type to get the information missing.

Using function pointers certainly work, but requires more care and it forces all the underlying components to pass around this "void *".

Top Content Up
Prec

Next
Table of content
One big HTML document