There is no correct option for me. My actual answer is "I know about them and could do complex things with them when they're the right tool, but for the kind of programs I write they're never needed."
Poll: How many programmers don't know about bit-wise operations?
31–40 of 82 posts
Re: Poll: How many programmers don't know about bit-wise operations?
#32Re: Poll: How many programmers don't know about bit-wise operations?
#33Never once used them in actual application development or web development since 1996. For me and the stuff I work on (web dev mostly) they're unreadable by others and any performance gains wouldn't be noticed or even cared about.
Re: Poll: How many programmers don't know about bit-wise operations?
#34I have always wondered why I was taught binary as if they were arrays, but programming languages never allowed me to use bits like arrays. It's always masking and shifting uint16_t or int32_t, instead of what I really want, "result = bits[3] xor bits2[3]".
Super handy when you're dealing with oddly packed int representations and such.
Re: Poll: How many programmers don't know about bit-wise operations?
#35((width * bytes_per_pixel)+3&~3) anyone? Can't remember how many times I've done that for Windows bitmap stride. WORD/DWORD/QWORD alignment was something I had to do frequently in C or C++ code. Even fixed point math for speed in the really old days.
Re: Poll: How many programmers don't know about bit-wise operations?
#36I like the elegance of bitwise operations and use them sometimes in signal processing applications to avoid a performance hit, though I'm no expert. But I avoid them in any high level code because a) the compiler is likely going to optimize that anyway and b) to be as human-readable as possible, the code should clearly describe the objective rather than exploit the underlying mechanism. In other words if I want to mu…
The major advantage of bitwise operators for me is the memory savings that come with them. I used to write the route calculation algorithms for routers and every bit/byte save had an tremendous impact on the total capacity of the router. We use bitfields to set and store various things from simple flags to multi-bit values, all inside a single integer variable.
Re: Poll: How many programmers don't know about bit-wise operations?
#37This is just a generalisation of course, I use them on occasion. Mostly with string encoding oddities.
For me using excessive bit operations is a red flag. I wrote a messy 1000 line file format in C, I found out by chance there was a serialization function in the library. 10 lines, done. I repeated this mistake when I started learning python (pickle, you're the best).
Re: Poll: How many programmers don't know about bit-wise operations?
#38Re: Poll: How many programmers don't know about bit-wise operations?
#39Earlier quoted context omitted.
At the moment, the linked submission is sitting at 2 points. The default is 1 point, and I'm the +1 up-voter. People writing code should know these things, but the move away from learning real low level languages means many people never learn these things. NOTE: The "low level" languages are assembly, microcode, and machine code, but never C. In spite of claims to the contrary, C is a high level language. When employ…
Because 90% of all programmers don't do much than writing plain CRUD applications.
Re: Poll: How many programmers don't know about bit-wise operations?
#40I have always wondered why I was taught binary as if they were arrays, but programming languages never allowed me to use bits like arrays. It's always masking and shifting uint16_t or int32_t, instead of what I really want, "result = bits[3] xor bits2[3]".
The answer is hardware design. Most machines are at best "Byte Addressable" which means you have an address for a specific byte. In some cases, even if the system is "Byte Addressable" it's still actually faster to use blocks of bytes (2Byte/16bt, 4Byte/32bit, 8Byte/64bit). The reason why this is true is because the hardware design was optimized to handle blocks. Though I'm sure "Bit Addressable" hardware exists, I'v…
Anyhow, the point is, limitations of the underlying system aren't excuses for why this syntax isn't implemented. If I can write bitmasks, then so can a compiler, right?