No Reuse of Standard Typemarks (RPP13)
Level \(\rightarrow\) Advisory
- Category
- Safety:
\(\checkmark\)
- Cyber:
\(\checkmark\)
- Goal
- Maintainability:
\(\checkmark\)
- Reliability:
\(\checkmark\)
- Portability:
\(\checkmark\)
- Performance:
- Security:
Remediation \(\rightarrow\) Low
Verification Method \(\rightarrow\) GNATcheck rule:
overrides_standard_name
Reference
N/A
Description
Do not reuse the names of standard Ada typemarks
(e.g. type Integer is range -1_000 .. 1_000;
)
When a developer uses an identifier that has the same name as a standard
typemark, such as Integer
, a subsequent maintainer might be unaware that
this identifier does not actually refer to Standard.Integer
and might
unintentionally use the locally-scoped Integer
rather than the original
Standard.Integer
. The locally-scoped Integer
can have different
attributes (and may not even be of the same base type).
Applicable Vulnerability within ISO TR 24772-2
N/A
Applicable Common Weakness Enumeration
Noncompliant Code Example
type Boolean is range 0 .. 1 with Size => 1;
type Character is ('A', 'E', 'I', 'O', 'U');
Compliant Code Example
type Boolean_T is range 0 .. 1 with Size => 1;
type Character_T is ('A', 'E', 'I', 'O', 'U');
Notes
N/A