[ad_1]
As far as function pointers in
Cgo, you need to pass the state as an extra parameter. That’s in opposition to languages like python, javascript or C++ that have closures. And that means storage duration needs to be considered for that extra structure.C programmers do make use of function pointers. And you can’t write very generic code without using function pointers. We just apply discipline and pass the captured state in a structure, as a function parameter.
1
[ad_2]
solved Why are function objects better than function pointers?