14 Sep
2013
14 Sep
'13
8:42 p.m.
On 14-9-2013 22:09, Markus Engel wrote:
Hi there,
SP_TYPE() macros should be reimplemented as dynamic_cast so that
they generate compile-time errors when something not derived from SPObject is passed. I checked that and it is currently impossible without changing a huge amount of code. Some parts use these GSLists and they store void-pointers. Thousands of SP_TYPE-lines would fail compilation. I'd suggest doing this change later.
I think it is important that we preserve run-time checking of these casts (from parent to child). Would this be acceptable for now? : #define SP_ITEM(obj) ( SP_IS_ITEM(obj) ? (SPItem*)obj : NULL )
I'm afraid that otherwise, bad casts will be much harder to track down.
Ciao, Johan