Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I guess programming languages don't really encourage using bit wise operations.

On top of it, it doesn't have many advantages. It takes much less memory, but takes more lines to write, while on the hardware, it's the opposite: more memory, not so fast processors.

What always bugged me, is that there are no real programming facilities to take advantages of bits, like encoding many variable in on 32 bit integer variable.

I guess



Although not part of the language proper, C++'s STL has vector<bool> that packs boolean flags into a bitvector (a now regrettable optimisation, since it doesn't function the way a container should - a story for another time). There is also bitset, which is similar but static.

Erlang has a beautiful language feature for this: http://www.erlang.org/doc/programming_examples/bit_syntax.ht... It uses pattern matching to unpack variable length fields in a bitvector. So beautiful.

Edit: Check arianvanp's post above https://news.ycombinator.com/item?id=5506902




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: