rspec/rules/S2192/rule.adoc
Marco Borgeaud 4e0e265d9e Update links to securecoding.cert.org
They redirect to https://wiki.sei.cmu.edu.
Fix broken links for open rules.
Remove broken links from closed rules.
Remove links in Java rules for CERT C rules with no obvious replacement.
Expand broken tinyurl to CERT.
2024-08-22 09:59:26 +02:00

48 lines
943 B
Plaintext

== Why is this an issue?
The size of integer that is required when a pointer is converted to an integer is implementation-defined. Casting between a pointer and an integer type should be avoided where possible, but may be unavoidable when addressing memory mapped registers or other hardware specific features.
Note that {cpp} does not permit a pointer to be converted to any floating type.
=== Noncompliant code example
[source,text]
----
struct S
{
int32_t i;
int32_t j;
};
void f ( S * s )
{
int32_t p = reinterpret_cast< int32_t >( s ); // Noncompliant
}
----
== Resources
* MISRA {cpp}:2008, 5-2-9
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
=== duplicates: S1767
=== is related to: S1767
=== relates to: S1944
=== on 23 Oct 2014, 15:10:28 Ann Campbell wrote:
\[~samuel.mercier] I'm thinking this is either a "bug" or a "pitfall"...
endif::env-github,rspecator-view[]