sizeof is applied to a standard container or string, which gives the size of the object and not of its elements
What it finds
sizeof(v) for a std::vector or std::string is the size of the handle, a few pointers, whatever the number of elements; the element count is v.size() and the bytes v.size() * sizeof(v[0]).
From the rule's source, sizeof_container.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/cpp:sizeof-container" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/cpp:sizeof-container] reason="..."tx0 explain tx0/cpp:sizeof-container shows the same in the terminal. Found a false positive? Report it.