我如何解决此警告? 带有警告的信息消息;
char.cpp: In constructor 'switch_channel_info::switch_channel_info()':
char.cpp:7370:6: warning: 'switch_channel_info::secs' will be initialized after [-Wreorder]
7370 | int secs;
| ^~~~
char.cpp:7369:22: warning: 'DynamicCharacterPtr switch_channel_info::ch' [-Wreorder]
7369 | DynamicCharacterPtr ch;
| ^~
char.cpp:7374:2: warning: when initialized here [-Wreorder]
7374 | switch_channel_info()
警告部分如下。
EVENTINFO(switch_channel_info)
{
DynamicCharacterPtr ch;
int secs;
long newAddr;
WORD newPort;
switch_channel_info()
: secs(0),
ch(),
newAddr(0),
newPort(0)
{
}
};
答案 0 :(得分:0)
在本节中,当我用ch变量替换secs变量时,警告消失并且问题得以解决。
DynamicCharacterPtr ch;
int secs;
long newAddr;
WORD newPort;
我进行了如下更改,问题得以解决。
int secs;
DynamicCharacterPtr ch;
long newAddr;
WORD newPort;