No need. Please read this first. Continue reading “C++ lvalues, rvalues, glvalues, xvalues, making you leave the party?”
The “crown jewel” of the post first. I use standard C++ and this macro :
// guaranteed no evaluation
// guaranteed zero bytes overhead
// can be placed in any scope
#define DBJ_REMOVE(...) \
static_assert( (noexcept(__VA_ARGS__),true) )
Any number of any legal arguments works. In or out of functions. In or out a namespace. Yes it is a macro too.
That is runtime zero cost.
noexcept is compile time affair. And since the result is cast to “nothing” aka
void that compiles to exactly 0 bytes.
“… C++ is not a bad language per se. It’s just, well kinda suffers from bloat. In the words of Richard E. Gooch, “It seduces the programmer, making it much easier to write bloatware“…”
“…There are issues such as dynamic memory allocation in C/C++, which is forbidden, under the DO-178B standard, in safety-critical embedded avionics code…”
Before knowing the above, the other day I have developed a handy little template to hold and provide, a plain 2d array, completely on the stack (aka the “matrix”).
It is also fully “compile time capable” with the full static internal presentation.
It is very handy to gently enforce company-wide C++ policies and to give some useful functionality in return. I am calling this approach “almost a pod”. Continue reading “Simple matrix for the rest of us”
Interface inheritance is good.
Just stumbled upon this excellent and succinct short text on how not to use inheritance. In C++ in particular, and I am adding: in general.
That text is precisely about differences v.s. the Objective-C, but it is priceless if and when you spot the growth of the weed of inheritance. Continue reading “C++ Inheritance easily grows out of control”