获取Apple clang版本和相应的上游LLVM版本 [英] Get Apple clang version and corresponding upstream LLVM version
问题描述
我想了解我的Macbook中安装了哪个版本的clang Apple,以查看具有c ++ 11和/或c ++ 14功能的功能. 我输入了以下命令:
I want to understand which version of clang Apple installed in my macbook, to see with c++11 and/or c++14 features are available. I typed this command:
clang --version
//----response
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
但是我无法理解(clang-700.1.76)
的含义.
如何将这段代码转换为clang版本?
But I am not able to understand what (clang-700.1.76)
mean.
How can I convert this code to a clang version?
在此站点上,您可以检查clang版本 http://clang.llvm.org/cxx_status.html中可用的c ++功能
This is the site where you could check c++ features available in clang version http://clang.llvm.org/cxx_status.html
推荐答案
编译器的(Apple)版本号几乎没有用,因为您还需要考虑代码是使用libstdc++
还是libc++
编译的(或任何其他标准库)-以及它们的哪个版本.
The (Apple) version number of the compiler is mostly useless, since you also need to consider whether your code is compiled with libstdc++
or with libc++
(or any other standard library) - and which version of those.
如果要测试语言或库功能,最好检查其他定义的值,例如__cplusplus
,__cpp_constexpr
,__cpp_variadic_templates
等.虽然不是很完美,但是看起来效果更好(如果您想获得可移植性),根据我的经验,所有主要编译器的支持正在改善.
If you want to test for language or library features, it is better to check other defined values, e.g., __cplusplus
, __cpp_constexpr
, __cpp_variadic_templates
, etc. It is not perfect, but it seems to work better (if you want portability) in my experience and the support from all major compiler is improving.
每个C ++标准版本都为__cplusplus
定义了一个值,一些编译器使用中间值来表示我们已经在C ++ 14上启动,但还没有开始".在需要时使用>=
进行测试.
Each C++ standard version defines a value for __cplusplus
, some compilers use intermediate values to say "we already started on C++14, but we are not there yet". Use >=
to test when needed.
The other feature test macros are similar, you can find the current version at N4440. Not all compilers implement N4440, though.
这篇关于获取Apple clang版本和相应的上游LLVM版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!