2014-05-13, 10:42
I was wondering if there's a reason a number of places are using static_cast instead of dynamic_cast, and then checking for a null result?
There's quite a few places in the dialog code, but a simple example is this function:
https://github.com/xbmc/xbmc/blob/master...s.cpp#L490
My main query is the last null check, static cast will only return null if the data was null, which was already checked. However, dynamic cast would return null for the wrong type, which I'm wondering if that's actually the desired behaviour?
Should these kind of casts actually be dynamic casts? Or are the null checks redundant?
There's quite a few places in the dialog code, but a simple example is this function:
https://github.com/xbmc/xbmc/blob/master...s.cpp#L490
My main query is the last null check, static cast will only return null if the data was null, which was already checked. However, dynamic cast would return null for the wrong type, which I'm wondering if that's actually the desired behaviour?
Should these kind of casts actually be dynamic casts? Or are the null checks redundant?