News for hackers. Stuff that matters.
Re:A Bit Overcomplicated by Alupis on Thursday August 05, 2021 @04:38PM (#28079407)
> unless you happen to work with binary formats and protocols

ie, embedded systems and microcontrollers - which is where binary formats and bitwise operations still rule out of necessity (limited processing power, precious cycle counts per operation, limited memory and storage, etc).

I highly doubt your average web or app developer will ever need to use bitwise operations. They're harder to read and understand quickly, and none of the limitations that make bitwise operations attractive exist on devices with gigabytes of ram and terabytes of storage.

Re:A Bit Overcomplicated by FpUser on Thursday August 05, 2021 @05:17PM (#28079983)
>"They're harder to read and understand quickly"

Disagree. Never had problem with bits. Also it is one of the basics of general computing so it would not hurt to know about the subject.

Re:A Bit Overcomplicated by Alupis on Thursday August 05, 2021 @05:30PM (#28080164)
Doesn't hurt to know it, sure, but it's entirely not useful for a large majority of developers these days.

Something like:

    (some_var & 0x003ff000) >> 12;
Or even:

    _displayControl &= ~DISPLAY_ON;
Is not immediately clear what is going on (other than some masking and shifting is happening), and these are simple cases without a lot going on. To understand these operations, we have to figure out what's significant about these numbers, what the variables might be here, etc.

It's a lot easier to understand:

    display.disable();
Which is what most higher-level-language developers (web, apps, even backend, and more) will use and expect to find in a codebase.
Re:A Bit Overcomplicated by BulgarianIdiot on Thursday August 05, 2021 @07:18PM (#28081327)
What you're saying: "In practice good modern API design prefers explicit intent over low-level details like exposing bitshifting for flags"

What people are saying to you: "You say bitshifting is complex, so if I say bitshifting is simple, it means I'm smarter than you"

Re:A Bit Overcomplicated by FpUser on Thursday August 05, 2021 @07:30PM (#28081414)
>"so if I say bitshifting is simple, it means I'm smarter than you"

To BulgarianIdiot: This is quite a conclusion.

Re:A Bit Overcomplicated by FpUser on Thursday August 05, 2021 @06:00PM (#28080546)
>"Doesn't hurt to know it, sure, but it's entirely not useful for a large majority of developers these days"

I read about a lot of things that are not immediately useful for me. Still somehow it falls into nooks and crannies of my brain and helps me to solve various problem when / if need arises. I do not even remember the exact things but general understanding of what is available and how does it functions approximately. If I need details Google does the rest.

>"It's a lot easier to understand:

    display.disable();"
No arguments about this one. Even though I do work with bits sometimes I wrap those into something digestible like your example. Inlining helps not to use performance when it is needed.