It seems that I’m one of those that have been called byte shift operations wrong for years :o . Still weird though that it’s on the Wikipedia bitwise operations page. Thanks for the info!
It’s actually a binary operation, with respect to the number of operands the operation takes. ‘-’ is an unary operator, when put in front of a 1 like this ‘-1’. ‘’ on the other hand is a binary operator, since it takes two arguments '24’.
‘?’ is a ternary operator since it takes three arguments: ’ (1>2) ? 1 : 0 ;', and that is a ternary operation.
I’m just writing this to clarify, since binary in this context is quite the homonymous term, it can easily be interpreted to have something to do with the numbers.
I am not sure if I understood fully the ado about the bitwise operations at Wikipedia, but as long as the right shift and left shift, is listed under bitwise operations in Kernighan & Ritchie, The C-Programming Language, I’ll stick with their definition.
That’s why I used that term too. Bitwise operations are normally operations that needs to be done on bit level. It’s normally bitwise operations vs. logical operations.
However, maybe depending on programming language, but static code like “-1” as a number in the programming language and is directly converted to signed integer; it’s not an operator. An better example of an unary operator would be the bitwise operations (here is the term correct) NOT. NOT will take only 1 argument and will perform an bitwise operation. It’s unary and bitwise
Ternary operators are logical operators. Ternary operators are not supported by the CPU and are always converted back into if-else statements; it’s just syntax.
It’s clear that naming the operators is done at different levels.