C/C++ Function Pointers
The cluster focuses on discussions about function pointers in C and C++, including their syntax, utility, limitations, alternatives like templates and vtables, and comparisons to other languages or mechanisms.
Activity Over Time
Top Contributors
Keywords
Sample Comments
How do you feel about C's function pointer syntax?
Same in C++. You can't do much with the function type itself as there are no objects with that type, but you can create references and pointers to it.
No function pointers? That severely restricts the utility of the language…
I think that he is talking about the cases where you can use template to avoid function pointer in C.
Please check your facts. C++ member functions are not as simple as function pointers inside structs.
Most 'non-fuctional' languages have function pointers too, it just might be less idiomatic.
At least in C it's only plain old function pointers.You don't have to think about exceptions, overloaded operators, copy constructors, move semantics etc.
Why are some functions addressable in C++ and others not? Seems like a pointless design oversight.
Don't use pointers to functions, or if you must then hide them behind typedefs.
Aren't std::functions effectively using something like vtables though?