MISRA C++:2023 Rule 4.1.2
Description
Rule Definition
Deprecated features should not be used.
Rationale
This rule prohibits utilizing C++ features that are listed as deprecated in Annex D of the C++ standard. A feature becomes deprecated when a safer or more efficient alternative exists. Occasionally, such features might be eliminated in subsequent versions of C++. Steering clear of deprecated features enhances the quality of your code and ensures its compatibility with future C++ versions.
Polyspace Implementation
The rule checker reports violations on the following deprecated features outlined in sections of Annex D of the C++17 standard:
Section in Annex D of C++17 Standard | Deprecated Feature |
---|---|
D.1 Redeclaration of static constexpr data members [depr.static_constexpr] | Redeclaration of |
D.2 Implicit declaration of copy functions[depr.impldec] |
|
D.3 Deprecated exception specifications [depr.except.spec] |
|
D.4 C++ standard library headers [depr.cpp.headers] | Headers |
D.6 char* streams [depr.str.strstreams] |
|
D.7 uncaught_exception [depr.uncaught] |
|
D.8 Old adaptable function bindings [depr.func.adaptor.binding] | Adaptable function bindings such as:
And similar types in templates such as |
D.8.3: Negators [depr.negators] | Negators such as:
|
D.9 : The default allocator [depr.default.allocator] | Following features of
In addition, the instantiation |
D.10: Raw storage iterator [depr.storage.iterator] |
|
D.11: Temporary buffers [depr.temporary.buffer] |
|
D.12 Deprecated type traits [depr.meta.types] | Type traits such as:
|
D.13 Deprecated iterator primitives [depr.iterator.primitives] | Use of |
D.14 Deprecated shared_ptr observers [depr.util.smartptr.shared.obs] |
|
D.15 Deprecated standard code conversion facets [depr.locale.stdcvt] |
|
D.16 Deprecated convenience conversion interfaces [depr.conversions] | Conversion interfaces such as:
|
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: General principles |
Category: Required |
Version History
Introduced in R2024b