you are viewing a single comment's thread
view the rest of the comments
[–] 30 points 1 year ago (6 children)

Bit fields are a necessity in low level networking too.

They're incredibly useful, I wish more people made use of them.

I remember I interned at a startup programming microcontrollers once and created a few bitfields to deal with something. Then the lead engineer went ahead and changed them to masked ints. Because. The most aggravating thing is that an int size isn't consistent across platforms, so if they were ever to change platforms to a different word length, they'd be fucked as their code was full of platform specific shenanigans like that.

/rant

  • source
  • parent
  • hideshow 6 child comments
  • [–] 4 points 1 year ago (2 children)

    Yeah. I once had to do stuff to code that had bit-fields like that and after a while, realised (by means of StackOverflow) that that part is UB and I had to go with bitwise operations instead.

  • source
  • parent
  • hideshow 2 child comments