Approximately 6 months ago I posted to Reddit. Under the title:
Decades have passed, standard C++ has no agreed and standard error handling concept.
That got attention and some important folks from the C+++ universe also chimmed in. More or less all approving.
I obviously had to show some code. No pressure there.
‘14ned‘ (well known as Nial Douglas) was especially helpfull, in that thread. This comment of his “sums it up” rather soberly I think:
“.. Zero overhead exceptions are not expected for C++ 23 currently, but rather as an experimental feature. If C adopts them for C23, then all the major compilers will have them, but they still wouldn’t enter until C++ 26 as for obvious reasons C++ 23 can’t incorporate C23..”
So, after decades of going in all directions at the same time, we are expected to wait “just few more years” to have ISO C++ error concept.
I can not wait that much. I need to have concept, design and cannocial implementations right now and right in the middle of several teams waiting. Or even worse inventing their own error concepts.
After months of cogitations, I have at last come out, with my “error concept”. Sufficiently light and simple. Effective if used ubiquotusily. Read on.
GitHub project is here. Readme constains the required text.
There is no ideal solution. On the implementation level there can be a lot of options. All of them equaly good. One can go ahead and implement DBJ ERRC to her liking. But stick to the DBJ ERRC core concept, and I can promise you, your C++ projects will be more consistent and most importantly interoperable with others, following the same Error Concept. At least on the level of error handling.