Recent submissions

Comment · 5 years ago
Except this (attempted) mask mandate ban was for kids - i.e. those who are often too young to receive a vaccine.

Yes, our federal government absolutely failed when it comes to vaccine supply. It is our state governments that have instituted lockdowns, because of this failure on behalf of the federal government, to squash cases and stop our hospital system from reaching breaking point.

Yes, our federal government screwed up, and I don't know anyone who doesn't agree with that point, but given that, and given the outcomes America experienced before vaccination was prevalent, it is the height of hubris and arrogance to suggest that you and the rest of the Western world (this "data" being pulled from where, exactly?) is "horrified at us".

Comment · 5 years ago
It is not endemic in many states in Australia.

But please, continue looking on in horror at us from (I'm assuming) America. Your post is a wonderful mix of condescending tone and factual inaccuracy, with the added cherry-on-top that you have absolutely moronic states like Florida "fighting for their freedoms" by banning mask mandates. This would be infuriating if it wasn't so painfully stupid.

Comment · 5 years ago
That's because modules and namespaces are the same thing in languages like Python, whereas they are separated in C++. The code in the imported module will go into whatever namespace it is in within that module, not the global namespace.
Comment · 5 years ago
Modules have nothing to do with shipping libraries (or dependency management), they are purely about encapsulation of interface and (API) implementation.
Comment · 5 years ago
If by "reload" you mean "drop in an updated shared library and let the runtime loader do its job", I suppose so.

Yes, it only applies if you don't make any API (and ABI) changes, but that's what major, minor, patch versioning is for, and stable projects can go a long way on minor and patch versions...

Comment · 7 years ago
> I can't remember the case in C, but in C++ the initialisation of a function local static variable is guaranteed to be thread-safe.

Only in C++11 onwards.

Comment · 7 years ago
Depending on what you required, it can still be significantly faster than std::map. Any tree-based data structure is going to play havoc with cache. Also, it will perform an allocation for every single node inserted, which can become rather expensive (unless you're using some customized allocator for this).

Honestly, sorted vectors can often be a good replacement, depending on the workload, if you must have ordered data (this is what boost flat_map uses). All 3 (map, unordered_map, sorted vector) can have their uses, depending on what you are doing with the data.

If you need a better performing hash map, there's always Abseil as well.

Comment · 7 years ago
Define "way easier". The interface, at least for day to day operations, is basically identical.
Comment · 7 years ago
I remember this being in the context of video games, and from some time ago (so things may have changed with Steam sales and the like), but it said that something like 85% of sales occur in the first two weeks. Thus the DRM was there to (hopefully) hold out for as much of that initial time as possible.

Anyway, anecdotal story, take with (many) grains of salt.

Comment · 7 years ago
Correctness defined as "this produces the right answer" vs correctness defined as the above with the addition of "this does not leak information / is not highly vulnerable to side-channel attacks" are very different things, and only one of those definitions is actually useful for cryptography.

Writing it yourself for the first time, or just copying some code off the internet, is going to have a vanishingly small chance of being actually secure.

Comment · 7 years ago
I mean, you really are a special case - I have only lightly dabbled in Rust, but I immediately recognize your name because of the work you've done in the Rust community.
Comment · 7 years ago
If you have the luxury of choosing between C++ and Java/C#, then you don't need C++.
Comment · 7 years ago
This doesn't take into account the alignment of the type though (you'd want to use std::aligned_storage<sizeof(T), alignof(T)>), but that requires knowing enough about T to be able to use sizeof() and alignof(), which means no incomplete types, bringing us back to where we started.
Comment · 8 years ago
This could only ever be doable with extremely simple architectures anyway. Off the top of my head, add in just one of branch prediction, micro-op fusion, out-of-order execution, pipelines and pipeline stalls, or cache misses, and this becomes impossible. Of course, this assumes you even know which CPU you are targeting its specific instruction latencies.

That's already an extremely niche set of processors. Further, the number of bits of code you're likely to care about this kind of extremely precise timing for, you'll either examine the emitted assembly, or just hand-write the ASM yourself.

It seems like a huge amount of effort for an extremely niche scenario. Remember, the ISA is still just an abstraction, after all.

Comment · 8 years ago
Sure, you can pass by pointer instead of reference, but the post also mentioned that they didn't use the STL (hence no std::vector) and I'm curious if that means they used a replacement library or something else.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton