Operators in C and C++: Difference between revisions

Content deleted Content added
Info that was illogically/incorrectly under evaluation order is moved to intro as it's pretty high-level info
Bitwise: Use shorter names based on context
Line 175:
! outside class
|-
| {{rh}} colspan="2" | [[Bitwise operation#NOT|Bitwise NOT]]
| align="center" | <code>'''~'''a</code><br/>
| {{cpp|1=R K::operator ~();}}
| {{cpp|1=R operator ~(K a);}}
|-
| {{rh}} colspan="2" | [[Bitwise operation#AND|Bitwise AND]]
| style="text-align:center;" | <code>a '''&''' b</code>
| {{cpp|1=R K::operator &(S b);}}
| {{cpp|1=R operator &(K a, S b);}}
|-
| {{rh}} colspan="2" | [[Bitwise operation#OR|Bitwise OR]]
| style="text-align:center;" | <code>a '''<nowiki>|</nowiki>''' b</code>
| {{cpp|1=R K::operator {{!}}(S b);|lang=cpp}}
| {{cpp|1=R operator {{!}}(K a, S b);|lang=cpp}}
|-
| {{rh}} colspan="2" | [[Bitwise operation#XOR|Bitwise XOR]]
| style="text-align:center;" | <code>a '''^''' b</code>
| {{cpp|1=R K::operator ^(S b);}}
| {{cpp|1=R operator ^(K a, S b);}}
|-
| {{rh}} colspan="2" | [[Bitwise shift|BitwiseShift]] left shift]]<ref name="bitshift" group="lower-alpha" />
| style="text-align:center;" | <code>a '''<<''' b</code>
| {{cpp|1=R K::operator <<(S b);}}
| {{cpp|1=R operator <<(K a, S b);}}
|-
| {{rh}} colspan="2" | [[Bitwise shift|BitwiseShift right shift]]<ref name="bitshift" group="lower-alpha" />{{Refn | Operation="rightbitshift" | group="lower-alpha" | According to the C99 standard, the right shift of a negative number is implementation defined. Most implementations, e.g., the GCC,<ref name="Integers">{{Citation | contribution = Integers implementation | url = //gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Integers-implementation.html#Integers-implementation | title = GCC 4.3.3 | publisher = GNU}}.</ref> use an [[arithmetic shift]] (i.e., sign extension), but a [[logical shift]] is possible.}}
| style="text-align:center;" | <code>a '''>>''' b</code>
| {{cpp|1=R K::operator >>(S b);}}