大佬教程收集整理的这篇文章主要介绍了c – 有关模板的编译器警告,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
1 #include <cstdlib> 2 #include <iostream> 3 4 enum { SIZE_PER_CHUNK = ((1<<16) / sizeof(unsigned)) }; 5 6 class TrueType {} ; 7 class falseType {} ; 8 9 template< std::size_t V,bool B = (((V) & ((V) - 1)) == 0) > class IsPowerOfTwo_; 10 template< std::size_t V > class IsPowerOfTwo_< V,true > : public TrueType {}; 11 template< std::size_t V > class IsPowerOfTwo_< V,false > : public falseType {}; 12 13 typedef IsPowerOfTwo_< SIZE_PER_CHUNK > IsPowerOfTwo; 14 15 16 int main() { 17 IsPowerOfTwo p2; 18 19 std::cout << "Hello World!" << std::endl; 20 return 0; 21 }
以下代码给出了编译器警告(gcc 4.6.2,/ project / dfttools / compile / lnx-x86 / gcc-4.6.2):
@H_404_13@
warning: suggest parentheses around ‘-‘ in operand of ‘&’ [-Wparentheses]
警告指向第13行,但它可能与第9行中的表达式有关.
有解决方案吗
以上是大佬教程为你收集整理的c – 有关模板的编译器警告全部内容,希望文章能够帮你解决c – 有关模板的编译器警告所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。