Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fjatWbyT opened this issue Nov 11, 2024 · 0 comments
Open

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

fjatWbyT opened this issue Nov 11, 2024 · 0 comments
Labels
false positive/false negative An issue related to observed false positives or false negatives. Standard-AUTOSAR

Comments

@fjatWbyT
Copy link
Contributor

fjatWbyT commented Nov 11, 2024

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;
};
@fjatWbyT fjatWbyT added the false positive/false negative An issue related to observed false positives or false negatives. label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false positive/false negative An issue related to observed false positives or false negatives. Standard-AUTOSAR
Projects
None yet
Development

No branches or pull requests

2 participants