News for hackers. Stuff that matters.
Re:Basics Of Function Pointers In C by deletes on Thursday August 01, 2013 @08:00AM (#6139645)
I don't see the need to do the "ret->doThink = null_think;" since you always pass ret to the function. Just call null_think( ret... )
Re:Basics Of Function Pointers In C by angersock on Thursday August 01, 2013 @02:11PM (#6142233)
Ah, but what if the object is handed over to some other deep end of the code? We want to bake the null behavior into it so that any Foo knows how to think itself--calling code just needs to be aware that any Foo object will always have a valid think callback defined.

This is basically the null-object pattern.