我一直在测试 clang-llvm,看看是否值得向我学校的 IT 部门提及以将其添加到我们学生编程的机器上。对于我们所有的作业,我们都需要使用 编译g++ -Wall -W -pedantic-errors *.cpp
,所以我只是将命令转换为clang++ -Wall -W -pedantic-errors
. 我得到了一些我没想到的输出:
Attempting to compile...
In file included from test_library.cpp:6:
In file included from ./test_library.h:64:
In file included from ./library.h:167:
./library.hpp:20:23: warning: unused variable 'e' [-Wunused-variable]
catch(Exception & e)
^
而 GCC 编译器不会给出关于 catch 块中未使用变量的错误。有什么我可以做的,以使 Clang 不会对 try/catch 块中未使用的变量感到害怕,同时保持与 g++ 相似的命令?
Clang-LLVM(v2.7) GNU GCC(v4.4.4) Fedora 13