== 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[]
