As I see it, bitmasks are a very important tool for use cases where either performance or memory constraints are important. Performance, because bitwise operations can sometimes achieve the same as more complex arithmetic, but at a fraction of the cost. And memory constraints because storing a single conceptual boolean value in a single bit is about as efficient as you can get, memory-wise.
Although it surely isn't the only one, C++ is truly the language for highly optimized computing. I like the fact that one can have many options for a number data type. For example, we can choose to be as memory-efficient as we want by using a short over a normal int type; unlike in JavaScript where all numbers are 64-bit IEEE 754-compliant. This is good for beginners because they don't have to worry about the intricacies of the language, but when it comes to servers and other large-scale operations, it might be a huge help to the workload if numbers weren't 64 bits long.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice discussion!
As I see it, bitmasks are a very important tool for use cases where either performance or memory constraints are important. Performance, because bitwise operations can sometimes achieve the same as more complex arithmetic, but at a fraction of the cost. And memory constraints because storing a single conceptual boolean value in a single bit is about as efficient as you can get, memory-wise.
Although it surely isn't the only one, C++ is truly the language for highly optimized computing. I like the fact that one can have many options for a number data type. For example, we can choose to be as memory-efficient as we want by using a
short
over a normalint
type; unlike in JavaScript where all numbers are 64-bit IEEE 754-compliant. This is good for beginners because they don't have to worry about the intricacies of the language, but when it comes to servers and other large-scale operations, it might be a huge help to the workload if numbers weren't 64 bits long.