gpt4 book ai didi

c++ - g++ (C++) 警告 : statement has no effect (toggle bool ! = bool)

转载 作者:行者123 更新时间:2023-11-30 01:17:08 26 4
gpt4 key购买 nike

<分区>

我假设我在 C++ 中收到此警告。

当我尝试使用 g++ 构建我的程序时

g++ --version

g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

file.cpp: In function âvoid mainloop(THREAD_DATA*)â:
file.cpp:970: warning: statement has no effect

typedef
struct THREAD_DATA_
{
struct spectate_player_t {
bool want_updates; /* want player updates by specating all players every 100 milliseconds (who are in ship of course) */
PLAYER *last_spec_player; /* last spectated player (just so it knows where it left off) */
bool direction; /* which direction spectating goes (used to avoid dead ends) so it cycles all players */
} spectate[1];
} THREAD_DATA;

...

static void mainloop(THREAD_DATA *td)

第 970 行只是一个开关,我曾经认为它在 C++ 中一直有效,所以我很困惑为什么它突然被删除或者警告可能毫无用处?

Line 967: if(td->spectate->last_spec_player)
Line 968: pkt_send_spectate_player(td->spectate->last_spec_player->pid);
Line 969: else
Line 970: td->spectate->direction != td->spectate->direction;

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