On one of these less forgiving architectures, how does one write programs that read some bytes off the network, bitcast them into a struct, and do something based on that?
On x86 you would use a packed struct that matches the wire protocol.
Wouldn’t this require extra copying if member reads were forced to be aligned?
yep exactly that. I had that exact issue. Junk coming in from a tcp/ppp connection then had to unpack it. Tons of garbage moves and byte offsetting and then making sure you keep the endianness correct too. On the platform I was using luckily memcpy could do most of what I needed. Not the best way to do it but the wildly out of date branch of gcc could do it. Got pretty good at picking junk out of random streams shifting and and/or whatever was needed. Totally useless skill for what I work on these days.
To add, the set of observable mutations (beneficial or not) that occur as a result of a single point mutation is in all likelihood an extremely tiny subset of the set of all observable mutations - even after “deduping” for the observed effect.
To simplify, It’s saying, if the genome were a string of some length, for any possible byte b and byte position i, there exists a person whose genome has b at position i. Unlike normal character strings, there are only 20 or so valid characters (proteins) encoded by 3 “bytes” (nucleotides) each. So you’re looking at O(10 billion) values of (i, b) that would still keep the string well-formed in its 3-bytes-per-character encoding.
Most importantly, it’s not saying anything about having some bytes b1 and b2 at the ith and jth positions or any generalization thereof.
In my example, the T is one specific type. So you could have std::vector<Cat>. If you also have Dogs, you just make another vector std::vector<Dog>. It works fine with the standard allocator. You don't have to do anything special.
If you wanted a factory that allocated vectors of a variety of known types, you'd probably declare template <typename T> before the generator function, so that on compilation a separate version of that function would be emitted for each type you passed to it.
(Not really a c++ expert, but that's my understanding; someone more knowledgeable can correct me).
> CMake doesn't fetch your dependencies for you and ensure they're the version that your code is compatible with.
That’s a little too harsh. You can certainly make it do that via a combination of git tags (to build from source) and CMake modules/Find*, but yes, it’s much more cumbersome than cargo/npm/go
(Author here) Thanks for explaining this more succinctly than I can :)
Just one nitpick:
> decent amount of stuff that has to be done in main before you run _start
should read
> decent amount of stuff that has to be done in _start before you run main
Analogously, cleanup code like running global destructors usually happens in _start/CRT after main returns, but I skipped that in the post for the sake of brevity.
> decent amount of stuff that CAN be done in _start before you run main
It’s all optional. Before I found the Linux kernel’s nolibc [0], I wrote a minimal C runtime based on bunch of stuff I read [1]. Only thing you really need to do is align the stack (at least on x86, amd64). You don’t get argc/argv/envp but main will still work.