내가 좋아하는 뭔가가있는 경우 : 나는 또한 주장하는 것과 동일한 통화를 사용하고, 그래서 별도의 FNC이 FNC 몸 밖으로 이동하고자하는 어설 션을 호출하는 함수를 호출 할 때 프로그램의 릴리스 버전에서 제거됩니까?
static long double calcFactor_(const short mantissa, const short exponent,const short base = Derived::internals_.base_)
{
assert(mantissa > 0);
assert(mantissa < NumericLimits<short>::max);
assert(exponent < NumericLimits<short>::max);
assert(exponent > NumericLimits<short>::min);
assert(base < NumericLimits<short>::max);
assert(base > NumericLimits<short>::min);
return mantissa * ::pow(static_cast<long double>(base),exponent);
}
내 프로그램의 다른 곳에서
및 지금 자산에 대한 호출이있는 곳에서이 fnc로만 호출하십시오. 하지만 내가 틀렸다면 정정 해줘 : 버전 릴리스에서 제거 될 예정 주장하는 사람들 호출하지만이있는 경우 :void Assert (//neccesary args here)
{
assert(mantissa > 0);
assert(mantissa < NumericLimits<short>::max);
assert(exponent < NumericLimits<short>::max);
assert(exponent > NumericLimits<short>::min);
assert(base < NumericLimits<short>::max);
assert(base > NumericLimits<short>::min);
}
또한 버전 릴리스에서 제거 여부 될이 FNC에 호출? 그리고 또 다른 Q 저는 최종 버전에서 제거 될 것이라는 주장이 있기 때문에 이익이되는 것이므로 if (! 조건) 체크를해야한다고 생각합니다. 어떻게 생각해?
NDEBUG가 정의되면 어설 션이 제거됩니다. 단언 문 안에 부작용이있는 명령문을 제거하는 것은 좋지 않기 때문에 절대로 수행하지 않는 것이 좋습니다. –
이 어설트들은 꽤 쓸모가 없다는 점에 유의하십시오. 'NumericLimits :: max' –
@Let_Me_Be 당신은 절대적으로 옳습니다. –