Out of Scope boost::bind

Thanks to the guys at StackOverflow I was able to come up with a clear example to demonstrate my point. The idea originated from unclear copying of member variables (in this context a function pointer) and as a result to very cryptic core dumps. It is not too uncommon that a object is no longer valid even through there are pointers still referencing it. This has been know for a long time now and the C++ standard library solves it by providing the programmer with many different types of smart pointers. And yes, other languages solve this by not exposing pointers to the developer. And as we know, the bug is usually located between the chair and the monitor, which makes this idea easy to follow.

Continue reading

If you enjoyed this post, then make sure you subscribe to my Newsletter and/or Feed.