2023-05-03 11:06:20 +02:00
== Why is this an issue?
2021-04-28 16:49:39 +02:00
If a re-declaration has compatible types but not types which are token-for-token identical, it may not be clear to which declaration that re-declaration refers.
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2021-04-28 16:49:39 +02:00
----
typedef int32_t INT;
INT i;
extern int32_t i; // Noncompliant
extern void f ( INT );
void f ( int32_t ); // Noncompliant
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2021-04-28 16:49:39 +02:00
----
typedef int32_t INT;
INT i;
extern INT i; // Compliant
extern void f ( INT );
void f ( INT ); // Compliant
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
== Resources
2021-04-28 16:49:39 +02:00
* MISRA {cpp}:2008, 3-9-1
2021-04-28 18:08:03 +02:00
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-09-20 15:38:42 +02:00
'''
== Implementation Specification
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== Message
Replace the type "xxx" to match the previous definition "yyy" in file "zzz" at line "aaa".
2021-09-20 15:38:42 +02:00
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== is related to: S1047
=== on 16 Oct 2014, 12:10:21 Ann Campbell wrote:
\[~samuel.mercier] please:
* fill in the appropriate reference field(s).
* provide a See section.
Also, in the message, will it be possible to give a hint about where that previous definition is located? Line # in same file or File name & line #?
=== on 21 Oct 2014, 15:53:50 Samuel Mercier wrote:
Updated the message. We need to check if it can be implemented.
=== on 17 Jul 2015, 11:13:32 Ann Campbell wrote:
\[~evgeny.mandrikov] see if you approve of my title rewording
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]