Live data from Hacker News

Understanding the power of bitwise operators

deusinmachina.net

1–10 of 48 posts

Re: Understanding the power of bitwise operators

#4
I like introducing people to new concepts, and I will assume this entry is for non-technologists. This is an excellent start.

If I may suggest, stop insulting your readers (e.g., several places implying reader does or does not do something 'normally', or not know something).

In cases where an error is well known, describe the error so it is understood you are using it as an example, and not an actual error (e.g., Null character (�) a black diamond with white question mark in the middle).

Single bit is the most often used type of data (vs "single bit is almost completely useless"). Your lights are on, or off; you are dead or alive; it is today or not, vast majority of network flags in various protocols are single bits.

There are a lot of weasel words throughout the post. If you plan to educate, uncertainty reduces comprehension and retention. There are some absolute statements are made too, but might rightfully questioned (e.g., [b]inary is the only language computers understand). Make sure your absolutes are truly absolutes.

Keep up the good work.

Re: Understanding the power of bitwise operators

#8
Who is this article for exactly? It starts off by trying to relate to the reader by presenting the point about learning a new programming language, but then goes on to explain one of the most fundamental concepts of computing, as if the reader is a complete novice. I would imagine that nearly every person with programming experience, whether that be formal or not, would have at least some familiarity with binary representation and bitwise operations.

Re: Understanding the power of bitwise operators

#10

I like introducing people to new concepts, and I will assume this entry is for non-technologists. This is an excellent start. If I may suggest, stop insulting your readers (e.g., several places implying reader does or does not do something 'normally', or not know something). In cases where an error is well known, describe the error so it is understood you are using it as an example, and not an actual error (e.g., Nul…

> (e.g., Null character (�) a black diamond with white question mark in the middle).

The description in the linked article is wrong, that's not a null character (U+0000) or ASCII's NUL. That black diamond symbol is U+FFFD the Unicode Replacement Character, it means "Something went wrong, so instead here is this symbol". For example if your decoder algorithm gets some gibberish and you can't or won't accept errors in decoding, a correctly designed decoder should produce U+FFFD each time, this is what Rust's String::from_utf8_lossy and String::from_utf16_lossy are doing.

U+FFFD was carefully chosen because it's not anything. It's not a letter, or a digit, it's not some ASCII control character, it's not a separator in any known writing system or protocol, it has no defined pre-existing purpose, which means if bad guys can trick your bad software into injecting U+FFFD into some data, chances are they achieved nothing of value.

Post reply on HN