& = ~b的代字号是什么? [英] What's the tilde in a &= ~b ?

查看:52
本文介绍了& = ~b的代字号是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


在这件事中我继承了这样的陈述:


a& = ~b;


其中a是int,b已经用这种方式声明:


const b = 0x0002;


因此也可能是一个int。


我的问题:在那里做什么?那是标准的C ++吗?什么

是什么意思?


干杯& =谢谢

本杰明

Hi everyone,

in this thing I inherited there''s a statement like this:

a &= ~b;

where a is an int and b has been declared this way:

const b = 0x0002;

and thus is probably an int as well.

My question: What''s the tilde doing there? Is that standard C++? What
does it mean?

Cheers &= thanks
Benjamin

推荐答案



" Benjamin B." <无***** @ today.com>在留言中写道

新闻:e0 ********** @ online.de ...

"Benjamin B." <no*****@today.com> wrote in message
news:e0**********@online.de...
大家好,

在这件事中,我继承了这样的声明:

a& = ~b;

其中a是int,b已经这样声明:

const b = 0x0002;

因此也可能是一个int。


(如果我记得,隐式int'不再使用。它应该指定const

int,为清楚起见,如果没别的话。)

我的问题:在那里做什么?那是标准的C ++吗?
是什么意思?
Hi everyone,

in this thing I inherited there''s a statement like this:

a &= ~b;

where a is an int and b has been declared this way:

const b = 0x0002;

and thus is probably an int as well.
(If I recall, implicit int''s are no longer used. It should specify const
int, for clarity if nothing else.)

My question: What''s the tilde doing there? Is that standard C++? What
does it mean?



这是按位补码运营商。它反转位(1s变为

0s,反之亦然)。 (你真的应该给自己一本好的C ++书,通过

的方式。)


-Howard


That''s the "bitwise complement" operator. It reverses the bits (1s become
0s, and vice-versa). (You really should get yourself a good C++ book, by
the way.)

-Howard




Benjamin B.写道:

Benjamin B. wrote:
大家好,

在这件事中我继承了这样的声明:

a& = ~b;

其中a是int,b已经用这种方式声明:

const b = 0x0002;

因此也可能是一个整数。

我的问题:在那里做什么?那是标准的C ++吗?
是什么意思?
Hi everyone,

in this thing I inherited there''s a statement like this:

a &= ~b;

where a is an int and b has been declared this way:

const b = 0x0002;

and thus is probably an int as well.

My question: What''s the tilde doing there? Is that standard C++? What
does it mean?




如果您熟悉所有这些按位运算符的门,

它不是。不要反转它的输入,所以当它有电源时它会关闭,当它是b $ b它没有打开时。功率为1,没有功率为0.输出为0,其中

有1和1,输入中有0。



If you are familiar with gates, which all these bitwise operators are,
it is NOT. NOT inverts its input so when it has power it is off, when
it doesn''t it is on. Power is 1, no power is 0. Output is 0 where
there is a 1 and 1 where there is a 0 in the input.


Howard写道:
" Benjamin B." <无***** @ today.com>在消息中写道
新闻:e0 ********** @ online.de ...
"Benjamin B." <no*****@today.com> wrote in message
news:e0**********@online.de...
大家好,

在这件事我继承了这样的声明:

a& = ~b;

其中a是int,b已经用这种方式声明:

const b = 0x0002;

因此也可能是一个int。
(如果我记得,隐式int'不再使用。它应该指定const
int,为清楚起见,如果没有别的。)
Hi everyone,

in this thing I inherited there''s a statement like this:

a &= ~b;

where a is an int and b has been declared this way:

const b = 0x0002;

and thus is probably an int as well.
(If I recall, implicit int''s are no longer used. It should specify const
int, for clarity if nothing else.)




当然应该。这是在待办事项清单上,还有更多。



Sure it should. It''s on the todo list, there are more of those.

我的问题:在那里做什么?那是标准的C ++吗?这是什么意思?
My question: What''s the tilde doing there? Is that standard C++? What
does it mean?



这就是按位补码运营商。它反转位(1s变为0s,反之亦然)。



That''s the "bitwise complement" operator. It reverses the bits (1s become
0s, and vice-versa).




非常感谢!

(你真的应该通过
的方式获得一本好的C ++书。)



Thanks a lot!
(You really should get yourself a good C++ book, by
the way.)




呃可能......虽然我宁愿专注于标准库<如果我有选择的话,可以选择... b / b和喜欢的...


干杯

本杰明



Uhm possible ... though I''ll rather concentrate on the standard library
and the likes if I have the choice ...

Cheers
Benjamin


这篇关于&amp; = ~b的代字号是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆