HN user

wmu

293 karma

I'm a programmer, here is my website http://0x80.pl

Posts4
Comments167
View on HN
Yes Hello 5 years ago

There are many scary things in the world. But the scariest is the line "Hi, I have a quick question". :)

Author here. I cannot use BSR, because have to execute code for all bits, regardless their value. The range is: the last bit to the first with value 1. It's a non-obvious iteration schema. :)

In continental Europe I have often been in a room with people from 10 different countries say Germany, France, Italy, Russia, Poland, India, China, Korea, England. Everyone could understand each other's broken English with the exception that half of the people couldn't understand English guy.

The problem is that most people are not exposed to real-life English. It's either quite artificial language during classes or well spoken lines in movies. Words are spoken slower and clearer. Native speakers speak fast, use linking, colloquial language, multitude of idioms, phrasal verbs, and tons of stuff never ever touched during classes.

We can call these things "flaws" or "traits", it doesn't really matter. The reality is SIMD hardware is ubiquitous, while the alternatives the article mentions are niche. Maybe except ARM SVE, which appeared this year on the market.

Regarding the C++ version: instead of copying data to a vector and then sorting the vector, it might be more profitable to use std::multimap<size_t, string>. This is a sorted container (likely rb-tree based) that handles duplicated keys.

Also, as somebody else mentioned, iostreams are slow. Even simple reading of file can be several times slower than plain C (http://0x80.pl/notesen/2019-01-07-cpp-read-file.html).

.DS_Store 5 years ago

The article mentions that the format was reverse-engineered, but the link goes to some extension database page, without any further details. Is the format really known?

Well, this is a nice example of lack of knowledge flow. The senior developer spent his time explaining things that should have been put in the procedure's comment. Yes, that's what comments are for.

You can, but you shouldn't. Use of fixed-point numbers is way more reliable, often faster as it's implemented with integer numbers, you can easily detect overflow, you can increase/decrease precision if you need, etc.

A perfect example of the small-scale-example syndrome. As somebody else noted here, throwing an exception in a noexcept context calls std::terminate. Figuring out why terminate was triggered in a large, multithread program sounds like a funny task until you have to do it by yourself.

The only place for noexcept are getters that return a copy of a POD value or a (const-)reference. Placing noexcept anywhere else is a call for problems.