3
これらの6つのメソッド(実際には警告をスローするものは非constバージョンです)は、C4717(すべてのパスで再帰関数)警告しかし、これらの次のメソッドは(まったく同じ私が言うことができる...)。 私には何が分からないのですか?C++ Visual Studio 2010 C4717コードの一部ではなく別のコードでのコンパイラの警告
警告発生方法:
template<class T>
const QuadTreeNode<T>* QuadTree<T>::GetRoot() const {
return _root;
}
template<class T>
QuadTreeNode<T>* QuadTree<T>::GetRoot() {
return static_cast<const QuadTree<T> >(*this).GetRoot();
}
template<class T>
const int QuadTree<T>::GetNumLevels() const {
return _levels;
}
template<class T>
int QuadTree<T>::GetNumLevels() {
return static_cast<const QuadTree<T> >(*this).GetNumLevels();
}
template<class T>
const bool QuadTree<T>::IsEmpty() const {
return _root == NULL;
}
template<class T>
bool QuadTree<T>::IsEmpty() {
return static_cast<const QuadTree<T> >(*this).IsEmpty();
}
非警告生成方法:
template<class T>
const Rectangle QuadTreeNode<T>::GetNodeDimensions() const {
return _node_bounds;
}
template<class T>
Rectangle QuadTreeNode<T>::GetNodeDimensions() {
return static_cast<const QuadTreeNode<T> >(*this).GetNodeDimensions();
}
この警告はバグであり、偽陽性を報告します。詳細については、[このバグレポート](http://connect.microsoft.com/VisualStudio/feedback/details/522094/)を参照してください。 – ildjarn
@ildjarn:だから...それはちょうど行くでしょうか?コンパイラを騙す方法はありますか? – Casey
バグだからベットはすべてオフです。個人的には、警告が間違っていることを知っていれば、私はそれを抑止します。 – ildjarn