Skip to content

False warning: 'm_significand' can be constructed in initializer list #11

@olegoratovskiy

Description

@olegoratovskiy

Description

Analyzer suggests constructing m_significand in the initializer list

Example

// int64_t m_significand & int64_t m_exponent are private fields of struct Exponential

Exponential::Exponential(int64_t number)
    : m_significand(number)
    , m_exponent(0)
{
    while (m_significand != 0 && m_significand % 10 == 0) {
        ++m_exponent;
        m_significand /= 10;
    }
}

Compile message

[  6%] Building CXX object CMakeFiles/expressions_lib.dir/src/exponential.cpp.o
error: 'm_significand' can be constructed in initializer list
m_significand /= 10;
        ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions