繁体   English   中英

C ++中'和','或'等关键字的目的是什么?

[英]What is the purpose of the 'and', 'or', etc. keywords in C++?

以下关键字的目的是什么?

and      bitand   compl   not_eq   or_eq   xor_eq
and_eq   bitor    not     or       xor

如果他们只是直接相当于:

&&       &        ~       !=       |=      ^=
&=       |        !       ||       ^

http://en.wikipedia.org/wiki/Iso646.h

iso646.h” ......定义了许多宏允许程序员使用C语言位运算符和逻辑运算符,其中,无头文件,不能对一些国际和非QWERTY键盘很快或很容易输入的。

文件名是指ISO646标准,这是一个7位字符集,带有许多区域变体,其中一些具有重音字符代替C运算符使用的标点符号。“

这样你就可以编写疯狂的代码诗:

class jack
{
   jack();
   jack( jack & jill );
   jack& came_tumbling( int after );
   jack& fell( jack & jill ); 
   jack& operator &= ( jack & jill );
   jack& operator & ( jack & jill );
}

void to_fetch( int pail );

int a_pail;
int after;
jack broke_his_crown;
jack went_up_the_hill;
jack down;

jack and jill = went_up_the_hill;
to_fetch( a_pail ); // of water
jack fell( down and broke_his_crown 
and jill.came_tumbling( after ));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM