Hacker News new | ask | show | jobs
by Someone 3499 days ago
It is a bit snarky, but also has a ground truth: pointers to functions aren't functions.

More importantly, you cannot make functions in C. For example, one cannot write a function that, given pointers to functions that compute 1/x and sin(x), returns a pointer to a function that returns 1/sin(x)

1 comments

That's not a function, that's a closure. And you can simulate that in C by creating a struct that contains the function pointer and the set of captured data (and then when you invoke the function you pass the struct to it as a parameter).
Yes, hence the distinction between first-class features and others, which you have to implement yourself.
The parent comment said C function pointers aren't functions. They are. They just aren't closures.