2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2020-06-30 12:50:59 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== Noncompliant code example
|
|
|
|
|
|
|
|
[source,cpp]
|
|
|
|
----
|
|
|
|
const int a = 0u; // Noncompliant
|
|
|
|
const int b = 0l; // Noncompliant
|
|
|
|
const int c = 0Ul; // Noncompliant
|
|
|
|
const int d = 0x12bu; // Noncompliant
|
|
|
|
const float m = 1.2f; // Noncompliant
|
|
|
|
const float n = 1.2l; // Noncompliant
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
|
|
|
|
[source,cpp]
|
|
|
|
----
|
|
|
|
const int a = 0U;
|
|
|
|
const int b = 0L;
|
|
|
|
const int c = 0UL;
|
|
|
|
const int d = 0x12bU;
|
|
|
|
const float m = 1.2F;
|
|
|
|
const float n = 1.2L;
|
|
|
|
----
|
2020-06-30 12:50:59 +02:00
|
|
|
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
== Resources
|
2020-06-30 12:50:59 +02:00
|
|
|
|
2021-01-26 14:30:57 +01:00
|
|
|
* MISRA {cpp}:2008, 2-13-4 - Literal suffixes shall be upper case
|
2020-06-30 12:50:59 +02:00
|
|
|
* MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a literal suffix
|
2020-12-21 15:38:52 +01:00
|
|
|
* https://wiki.sei.cmu.edu/confluence/x/cdYxBQ[CERT DCL16-C.] - Use "L," not "l," to indicate a long value
|
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)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
2023-06-22 10:38:01 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|