我今天注意到我的一个头文件仍在使用auto_ptr<>
模板。
我使用 -std=c++11 来确保在 C++11 中编译,并使用 -pedantic 和 -Werror 来检测不推荐使用的用法。所以我想我应该在编译那个头文件时出错,因为 auto_ptr 被标记为已弃用,你怎么看?
该课程的一部分具有令人反感的定义:
class server
{
[...snip...]
private:
std::auto_ptr<snap_listen_thread> f_listen_runner;
std::auto_ptr<snap_thread> f_listen_thread;
[...snip...]
};
下面列出了所有命令行选项。我正在使用 g++ 版本 4.8.2 (Ubuntu 4.8.2-19ubuntu1),我们可以看到我在列表中有 -pedantic 和 -Werror:
cd /home/snapwebsites/BUILD/snapwebsites/lib &&/usr/bin/c++ -DCONTROLLED_VARS_DEBUG -DDEBUG -DQT_CORE_LIB -DQT_DEBUG -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -D_DEBUG -Dsnapwebsites_EXPORTS -std=c++11 -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-隐私 -Wdisabled-optimization -Winit-self -Wlogical-op -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=4 -Wundef -Wno-未使用 -Wunused-variable -Wno-variadic-macros -Wno-括号 -Wno-unknown-pragmas -Wwrite-strings -Wswitch -fdiagnostics-show-option -fPIC -Wunused-parameter -Wfloat-equal -Wold-style-cast - Wnoexcept -g -g -O0 -fPIC -I/home/snapwebsites/snapwebsites -I/home/snapwebsites/snapwebsites/lib -I/home/snapwebsites/BUILD/snapwebsites -I/home/snapwebsites/BUILD/snapwebsites/lib -我/home/snapwebsites/BUILD/dist/include-I/home/snapwebsites/BUILD/dist/include/advgetopt -I/home/snapwebsites/BUILD/dist/include/QtSerialization -isystem /usr/include/qt4 -isystem /usr/include/qt4/QtXmlPatterns -isystem /usr /include/qt4/QtXml -isystem /usr/include/qt4/QtCore -isystem /usr/include/qt4/QtDesigner -isystem /usr/include/qt4/QtDeclarative -isystem /usr/include/qt4/QtScriptTools -isystem /usr /include/qt4/QtDBus -isystem /usr/include/qt4/QtSql -isystem /usr/include/qt4/QtOpenGL -isystem /usr/include/qt4/QtNetwork -isystem /usr/include/qt4/QtWebKit -isystem /usr /include/qt4/QtHelp -isystem /usr/include/qt4/QtUiTools -isystem /usr/include/qt4/QtTest -isystem /usr/include/qt4/QtScript -isystem /usr/include/qt4/QtSvg -isystem /usr /include/qt4/Qt3Support -isystem /usr/include/qt4/QtGui -isystem /usr/share/qt4/mkspecs/default -isystem /usr/include/proc -o CMakeFiles/snapwebsites.目录/snap_initialize_website.cpp.o -c /home/snapwebsites/snapwebsites/lib/snap_initialize_website.cpp
g++ 中会不会有一个错误,它不会偶尔检测到这种不推荐使用的模板?