以下關鍵字的用途是什麼?C++中'和','或'等關鍵字的用途是什麼?
and bitand compl not_eq or_eq xor_eq
and_eq bitor not or xor
如果所有他們是直接等同的:
&& & ~ != |= ^=
&= | ! || ^
以下關鍵字的用途是什麼?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運算符使用的標點符號。
而在C++中這些!不是宏,而是'替代令牌',並且不需要包含iso646.h。 – bames53
...但是它是一個遲緩的解決方案,因爲即使不使用&,〜和|字符也不能編程C++ 。這些替代令牌 –
@RafaelBaptista是的,你可以'詮釋常量BITAND答案= 42;?'是一個有效的變量聲明 –
它,所以你可以編寫代碼的瘋狂像詩:
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));
我寫的詩不太適合包含在我們的代碼庫中;) –
我們都希望在C++ 12他們將添加一個令牌楠塔基特 –
在這個片段中唯一的問題是,'和'相當於''&&,而不是'&'...:P – Griwes
並非所有鍵盤都有'&','〜','|'等按鍵。 – ildjarn
參見[iso646.h(http://en.wikipedia.org/wiki/Iso646.h) –
@馬特:我雖然感到驚訝的幾個同事,我一般喜歡'not'到''! '!'幾乎看不見,'不'(後面需要空格)突出。 –