c++ - Why does Qt use reinterpret_cast rather than static_cast for void*? -


you can cast to/from pointer t to/from void* static_cast, why qt use reinterpret_cast?

int some_object::qt_metacall(qmetaobject::call _c, int _id, void **_a) {     _id = qmainwindow::qt_metacall(_c, _id, _a);     if (_id < 0)         return _id;     if (_c == qmetaobject::invokemetamethod) {         switch (_id) {         // why reinterpret_cast here??         case 0: on_tabwidget_tabcloserequested((*reinterpret_cast< int(*)>(_a[1]))); break;         default: ;         }         _id -= 1;     }     return _id; } 

frankly, i've never been able figure out either. void ** structure created same way, casts int* void* , performs weird cast on other side. far can tell, static_cast not fine, better.

you'll find there's lot of questionable code in large projects qt. stuff slips through review or sticks around because nobody wants go through hassle of changing it.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -