gpt4 book ai didi

c++ - 将在 [-Wreorder] 之后初始化

转载 作者:IT老高 更新时间:2023-10-28 12:53:14 25 4
gpt4 key购买 nike

当我编译我的文件时,我收到了这个警告:

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++ - 将在 [-Wreorder] 之后初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30364585/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com