您可以使用static_cast投射到/从任意指向T的空指针*,为什么Qt使用reinterpret_cast?为什么Qt使用reinterpret_cast而不是static_cast作为void *?
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;
}
这个称号是非常混乱。我们可以有更多的细节吗? – 2011-02-18 22:10:44
重大编辑,是的。在你自己做之前,我可能已经把它从关闭中解救了出来。希望我明白了。 – 2011-02-18 22:18:32
此代码示例由`moc`生成,对吧? – aschepler 2011-02-18 22:23:14