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

时间:2012-06-28 18:12:13

标签: c++ operators operator-keyword keyword

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

and      bitand   compl   not_eq   or_eq   xor_eq
and_eq   bitor    not     or       xor

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

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

2 个答案:

答案 0 :(得分:13)

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

iso646.h “...定义了许多宏,允许程序员使用C语言的按位和逻辑运算符,没有头文件,无法在某些国际和非QWERTY上快速或轻松地输入键盘。

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

答案 1 :(得分:7)

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

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 ));
相关问题