Skip to content

A4-7-1: integer data loss false positive erasing from container #793

Open
@fjatWbyT

Description

@fjatWbyT

Affected rules

  • A4-7-1

Description

Decrement cannot lead to wrap-around since the container is checked for emptiness.

Example

class container
{
    bool empty()
    {
        return num_items_ == 0;
    }

    void erase()
    {
        if (empty())
            return;

        num_items_--;
    }

    std::size_t num_items_ = 0;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty-HighA false positive or false negative report which is expected to take 1+ week effort to addressImpact-MediumStandard-AUTOSARfalse positive/false negativeAn issue related to observed false positives or false negatives.

    Type

    No type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions