将在[-Wreorder]后初始化
will be initialized after [-Wreorder]
当我编译我的文件时,我得到这个警告:
In file included from AsyncSQL.cpp:8:0:
AsyncSQL.h: In constructor 'CAsyncSQL::CAsyncSQL()':
AsyncSQL.h:192:10: warning: 'CAsyncSQL::m_iCopiedQuery' will be initialized after [-Wreorder]
int m_iCopiedQuery;
^
这是我的AsyngSQL.H http://pastebin.com/u72kyuq7那么我做错了什么呢?
问题在于您在第22行
初始化列表中初始化成员的顺序。_SQLResult(): pSQLResult(NULL), uiNumRows(0),
uiAffectedRows(0), uiInsertID(0)
这些应该以它们在类定义中出现的顺序出现。例如:
class test {
test(): foo(1), bar(2) { }
int foo;
long bar;
};
相关文章:
- 是否可以初始化不可复制类型的成员变量(或基类)
- C++使用整数的压缩数组初始化对象
- C++初始化基类
- 多成员Constexpr结构初始化
- 复制列表初始化的隐式转换的等级是多少
- 内联映射初始化的动态atexit析构函数崩溃
- 如何在C++中初始化嵌套类中的2个memeber
- 如何声明特征矩阵,然后通过嵌套循环初始化它
- 没有用于初始化C++中的变量模板的匹配构造函数
- 在未初始化映射的情况下,将值插入到映射的映射中
- C++成员初始化
- 为什么在C++中首先初始化成员类
- 同时具有"聚合初始化"和"模板推导"
- 初始化具有非默认构造函数的std::数组项的更好方法
- 是否可以在编译时初始化数组,以便在运行时不会花费时间?
- 我可以使用条件运算符初始化C风格的字符串文字吗
- 在C和C++中初始化结构中的数组
- 标准是否使用多余的大括号(例如 T{{{10}}})定义列表初始化?
- 在函数内部的声明中初始化数组,并在外部使用它
- 将在[-Wreorder]后初始化