3 ms·
This is actually a quite old idea. Here's a comp.lang.c++.moderated thread from 2000 discussing the idea: https://groups.google.com/group/comp.lang.c++.modera
by odradek 16y ago
This is actually a quite old idea. Here's a comp.lang.c++.moderated thread from 2000 discussing the idea:
https://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/6466a3dfa2adf2b/d3b6d29cadfcc145?hl=de&ie=UTF-8&q=exploding+return+codes+c%2B%2B&pli=1#d3b6d29cadfcc145 https://groups.google.com/group/comp.lang.c++.moderated/brow...
The OP there did not pass an extra parameter, but used the return value itself to deliver the exploding return code.
I've used this from time to time as a debugging aid, because it allows me to track down places in my code where I forget error checks. Using the exploding codes in live code is not a good idea however, because they rely on throwing in destructors, which is a bad thing to do.