14 Sep
2013
14 Sep
'13
11:49 p.m.
On Sun, Sep 15, 2013 at 01:22:04AM +0200, Krzysztof Kosiński wrote:
inline SPItem *SP_TYPE(void *x) { return dynamic_cast<SPType*>(reinterpret_cast<SPObject*>(x)); }
I would just like to point out that void* -> T* does not need a reinterpret_cast, and using such is, in my opinion, confusing. The U *reinterpret_cast<U *>(T *) operator reinterprets the bytes making up an object of type T as an object of type U. Filling in void and SPObject in that sentence means you reinterpret the bytes making up an object of type void as an object of type SPObject, which doesn't make much sense. I suggest using static_cast, instead.
Pippijn