Skip to content

<cmath>: lerp() noexcept is now required, so we should remove comments #530

@StephanTLavavej

Description

@StephanTLavavej

Background: The Standard requires various functions to be marked noexcept, and additionally permits implementers to "strengthen" other functions of their choice by adding noexcept.

When our former intern Paolo Torres implemented lerp() in VS 2019 16.3, he noticed that noexcept was missing from its specification. He filed a Library Issue (bug report against the C++ Standard) LWG-3201 "lerp should be marked as noexcept", and he also strengthened his implementation. We follow a convention of marking such occurrences with comments:

STL/stl/inc/cmath

Lines 1387 to 1400 in e034296

_NODISCARD /* constexpr */ inline float lerp(
const float _ArgA, const float _ArgB, const float _ArgT) noexcept /* strengthened */ {
return _Common_lerp(_ArgA, _ArgB, _ArgT);
}
_NODISCARD /* constexpr */ inline double lerp(
const double _ArgA, const double _ArgB, const double _ArgT) noexcept /* strengthened */ {
return _Common_lerp(_ArgA, _ArgB, _ArgT);
}
_NODISCARD /* constexpr */ inline long double lerp(
const long double _ArgA, const long double _ArgB, const long double _ArgT) noexcept /* strengthened */ {
return _Common_lerp(_ArgA, _ArgB, _ArgT);
}

After the February 2020 meeting in Prague, Paolo's resolution for LWG-3201 has been accepted, so the C++20 Standard has caught up to his implementation (yay!). Accordingly, we should remove the /* strengthened */ comments on these overloads (as noexcept is required now).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationRelated to documentation or commentsfixedSomething works now, yay!good first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions