It seems likely I’ll have to move away from C++, or perhaps more accurately it’s moving away from me.
It seems likely I’ll have to move away from C++, or perhaps more accurately it’s moving away from me.
How well does this usually work, by the way?
It kinda is. The C++ committee has been getting into a bad habit of dumping lots of not-entirely-working features into the standard and ignoring implementer feedback along the way. See https://wg21.link/p3962r0 for the incipient implementer revolt going on.
So many features are starting to land which feel increasingly DoA, we seriously need a language fork
alignas(16) char buf[128];
What type is buf? What alignment does that type have? What alignment does buf have? Does the standard even say that alignof(buf) is a valid expression? The answers barely make sense.Given that this is the recommended replacement for aligned_storage, it’s kind of embarrassing that it works so poorly. My solution is to wrap it in a struct so that at least one aligned type is involved and so that static_assert can query it.
but in the rare case you need code like that be glad C++ has you covered
> but in the rare case you need code like that be glad C++ has you covered
I strongly disagree. alignof(buf) works correctly but is a GCC extension. alignof(decltype(buf)) is 1, because alignas is a giant kludge instead of a reasonable feature. C++ only barely has me covered here.
Just like Python was to blame for the horrible 2-to-3 switch, C++ is to blame for the poor handling of modules. They shouldn't have pushed through a significant backwards-incompatible change if the wide variety of vendor toolchains wasn't willing to adopt it.
But you might not be able to use libraries that insist upon modules. There won't be many until modules are widespread.