Skip to content

Commit

Permalink
put debug messages under debug #ifndef NDEBUG (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
ni-sujain authored Jun 29, 2023
1 parent 7f2ffa7 commit cab2938
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pointer_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ namespace grpc_labview
auto storedPtr = _registeredPointers.find(ptr);
if (storedPtr == _registeredPointers.end())
{
#ifndef NDEBUG
std::cerr << "ERROR: THIS POINTER IS NOT REGISTERED" << std::endl;
#endif // ! NDEBUG
if (status != nullptr)
{
*status = -1;
Expand All @@ -83,7 +85,9 @@ namespace grpc_labview
std::shared_ptr<TDerivedType> derivedPtr = std::dynamic_pointer_cast<TDerivedType>(storedPtr->second);
if (!derivedPtr)
{
#ifndef NDEBUG
std::cerr << "ERROR: CASTING POINTER TO MORE SPECIFIC TYPE FAILED" << std::endl;
#endif // ! NDEBUG
if (status != nullptr)
{
*status = -1;
Expand All @@ -100,7 +104,9 @@ namespace grpc_labview
std::lock_guard<std::mutex> lock(_mutex);
if (!ptr)
{
#ifndef NDEBUG
std::cerr << "ERROR: CANNOT REGISTER A NULL POINTER" << std::endl;
#endif // ! NDEBUG
return nullptr;
}

Expand All @@ -117,7 +123,9 @@ namespace grpc_labview
std::lock_guard<std::mutex> lock(_mutex);
if (!ptr)
{
#ifndef NDEBUG
std::cerr << "ERROR: CANNOT REGISTER A NULL POINTER" << std::endl;
#endif // ! NDEBUG
return nullptr;
}

Expand Down

0 comments on commit cab2938

Please sign in to comment.