|
![](/i/fill.gif) |
Fredrik Eriksson wrote:
>> I keep trying to sort out in my head which combination of symbols mean
>> bitwise operations and which ones mean logical operations.
>
> The bitwise operators are all single character. There are also only four
> of them. You get used to it.
Yeah, I guess so.
>> Using names makes the difference clear. (To me anyway.)
>> Of course, none of this helps with trying to read other people's code.
>
> Which is why it would be better in the long run to simply get used to
> the symbols.
It has a flavour.
>> (Now Haskell also uses symbols for both. However, in Haskell, if you
>> try to perform logical operations on numbers, you get a type error,
>> and vice versa. Unfortunately C++ inherits C's braindead "hey, if you
>> can represent it as an unstructured bit pattern, it's an int, right?"
>> mentallity.)
>
> The bitwise operators in C & C++ only work on integers. However, there
> are a few silent conversions to 'int' to be aware of.
Indeed.
(The other thing is that in Haskell, the logical ops are always there,
while the bitwise ones are hidden away in some library and you have to
explicitly ask for them.)
>> Who'd have thought? An M$ product bending the standard slightly...
>> </sarcasm>
>
> I hope you do not think GCC is standards-compliant by default either.
I gather that GCC provides various extensions of its own too, yes. ;-)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |