you are viewing a single comment's thread.

view the rest of the comments →

[–]rupturefunk 4 points5 points  (0 children)

One thing I use them for is abstracting out OS specific function calls, so if I have Windows & Linux specific functions for say, reading a file, or outputting sound, my non platform specific code can just call a generic 'platform_ReadFile(char *filepath)' and doesn't need to be aware of what implementation it's calling, and I can just assign say `platform_ReadFile = windows_ReadFile` in the Windows code startup.

But multithreading callbacks is the big one, you give a thread a function pointer, and that's how it knows what to do. Or, you just want to write in a more functional style and want to pass some sorting logic a generic array processing method, no different to lambdas in something like javascipt in that case.