Coding - Fix MSVC warnings C4723 and C4324 (#1060)

This commit is contained in:
Pasukhin Dmitry
2026-02-11 09:22:42 +00:00
committed by GitHub
parent 964a2c75df
commit a934911912
2 changed files with 20 additions and 4 deletions

View File

@@ -29,6 +29,10 @@ using namespace MathUtils;
//! @param theA coefficient of x
//! @param theB constant term
//! @return result containing 0 or 1 root, or infinite solutions flag
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4723) // potential divide by 0 - guarded by IsZero() check
#endif
inline MathUtils::PolyResult Linear(double theA, double theB)
{
MathUtils::PolyResult aResult;
@@ -43,14 +47,19 @@ inline MathUtils::PolyResult Linear(double theA, double theB)
{
aResult.Status = MathUtils::Status::NoSolution;
}
return aResult;
}
else
{
aResult.Status = MathUtils::Status::OK;
aResult.NbRoots = 1;
aResult.Roots[0] = -theB / theA;
}
aResult.Status = MathUtils::Status::OK;
aResult.NbRoots = 1;
aResult.Roots[0] = -theB / theA;
return aResult;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
//! Solve quadratic equation: a*x^2 + b*x + c = 0
//! Uses numerically stable formulas to avoid catastrophic cancellation.

View File

@@ -85,6 +85,10 @@ private:
//! Internal slot structure holding key, value, and metadata.
//! Key and item storage is uninitialized until state becomes Used.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4324) // structure was padded due to alignment specifier
#endif
struct Slot
{
alignas(TheKeyType) char myKeyStorage[sizeof(TheKeyType)];
@@ -114,6 +118,9 @@ private:
return *reinterpret_cast<const TheItemType*>(myItemStorage);
}
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
public:
// **************** Iterator interface ****************