c++ dynamic_cast error handling
- by Nazgob
Is there any good practice related to dynamic_cast error handling (except not using it when you don't have to)? I'm wondering how should I go about NULL and bad_cast it can throw.
Should I check for both? And if I catch bad_cast or detect NULL I probably can't recover anyway...
For now, I'm using assert to check if dynamic_cast returned not NULL value. Would you accept this solution on a code review?