rspec/rules/S818/cfamily/rule.adoc

52 lines
1.1 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:50:59 +02:00
include::../description.adoc[]
=== 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
== 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
* https://wiki.sei.cmu.edu/confluence/x/cdYxBQ[CERT DCL16-C.] - Use "L," not "l," to indicate a long value
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]