linux编译警告 will be initialized after


http://blog.chinaunix.net/uid-17019762-id-3152012.html 

 

作为一个有强迫症的人,实在是受不了 warning 的存在

这个warning是由于初始化顺序引起的
  1. // 会出现warning 的代码!
  2. class cInit
  3. {
  4. public:
  5.     cInit(std::string str, int a) : str_(str), a_(a)
  6.     { }
  7. private:
  8.     int a_;
  9.     std::string str_;
  10. };

 

  1. // OK
  2. class cInit
  3. {
  4. public:
  5.     cInit(std::string str, int a) : str_(str), a_(a)
  6.     { }
  7. private:
  8.     std::string str_;
  9.     int a_;
  10. };
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM