"This article was originally published in Polish in issue 4/2013" — a lot of excellent advice. Sad to see C++ have moved in last decade in a direction that makes writing efficient, simple low level code harder and harder :(
eh, yes-ish, but only thanks to compiler writers. at one point committee went all-out enforcing their lifetime model, making bit_cast not an option. If your code accesses same data using different types, you are spelunking ruins with snake pits and lava. more and more stuff needs magic support code in std::, making no-lib code less and less possible (it used to be that with no-rtti and no-exceptions, you could use all c++ features and only needed cxa_at_exit, operator delete, and few other little things. NOT ANY MORE).
On one hand, you have consteval and stuff, letting you FINALLY initialize data at compile time (hey, 20 years late but still!)
on other hand, it is done in most non-debuggable way possible. try setting breakpoint or adding print to constexpr function that causes your requires clause to fail...
so no, newer C++ the language is not possible to use for low level work. The dialects that compiler makers support are. We will see for how long
In my domain, code size is critical, so we use -fno-exceptions and -fno-rtti from necessity, for a good reason. Which means our code is non-conformant C++. Committee forces everyone to have exceptions and rtti always.
OK. I would expect those flags to be required for most embedded work.
But I could imagine use cases for new-ish constructs like `constexpr`, `std::variant`, template constraints, and so on.
I don't quite follow what you are saying about the compilers. Are you saying that in future, compilers will have to choose between supporting new features and allowing non-conformant code?
112233 · · focus · HN ↗
fooblaster · · focus · HN ↗
112233 · · focus · HN ↗
On one hand, you have consteval and stuff, letting you FINALLY initialize data at compile time (hey, 20 years late but still!)
on other hand, it is done in most non-debuggable way possible. try setting breakpoint or adding print to constexpr function that causes your requires clause to fail...
so no, newer C++ the language is not possible to use for low level work. The dialects that compiler makers support are. We will see for how long
t0mpr1c3 · · focus · HN ↗
This seems like an overstatement. Can you elaborate with some examples from your particular domain?
112233 · · focus · HN ↗
t0mpr1c3 · · focus · HN ↗
But I could imagine use cases for new-ish constructs like `constexpr`, `std::variant`, template constraints, and so on.
I don't quite follow what you are saying about the compilers. Are you saying that in future, compilers will have to choose between supporting new features and allowing non-conformant code?