Iss*_* T. 8 c++ exception-handling clang
这是我所说的代码部分.
try {
std::cerr << "first try" << std::endl;
po::store(po::parse_config_file(ifs, _configFileOptions, false), vm);
} catch(...) {
std::cerr << "second try" << std::endl;
}
Run Code Online (Sandbox Code Playgroud)
只是为了寻找细节,我使用boost program_options来解析配置文件.由于我在文件中添加了一个无法识别的选项,因此引发了异常.
Clang没有捕获此异常存在问题.基本上我只在输出中看到
first try
libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >: unrecognised option 'TestFrequency'
Abort trap: 6
Run Code Online (Sandbox Code Playgroud)
这是我的铿锵版:
c++ --version
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Run Code Online (Sandbox Code Playgroud)
编辑:当没有异常时,解析和一切正常.
| 归档时间: |
|
| 查看次数: |
949 次 |
| 最近记录: |