3 ms·
I often using something like this in C++ if( nullptr != pfnErrorSink ) pfnErrorSink( "outofrange", __FILE__, __LINE__ ); return E_BOUNDS; // Or
by Const-me 5y ago
I often using something like this in C++
if( nullptr != pfnErrorSink )
pfnErrorSink( "outofrange", __FILE__, __LINE__ );
return E_BOUNDS; // Or sometimes throw E_BOUNDS;
Where pfnErrorSink is either global, thread_local or a field keeping C function pointer provided by whoever consumes the code.