gpt4 book ai didi

c++ - 什么是 &= 和 |=

转载 作者:可可西里 更新时间:2023-11-01 18:04:09 25 4
gpt4 key购买 nike

我在大型代码库中浏览一些 VC++ 代码时遇到了这个:

    if (nState & TOOL_TIPS_VISIBLE)
nState &= ~TOOL_TIPS_VISIBLE;
else
nState |= TOOL_TIPS_VISIBLE;
break;

C++中有&=或|=这样的运算符吗?它有什么用?
它是否等同于 nState = nState & ~TOOL_TIPS_VISIBLE

最佳答案

x &= yx = x & y
相同x |= yx = x | 相同y

关于c++ - 什么是 &= 和 |=,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8006410/

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