----
void foo(const int* x)
{
  int* y;
  y = (int*)x;     //Noncompliant
}
int main()
{
  const int a = 10;
  int b;
  b = (int)a;    //Noncompliant
  return(0);
}
----
Converting const to non-const can undermine the data integrity by allowing values to change that are assumed to be constant. This practice also reduces the readability of the code, since you cannot assume const variables to be constant


== See

* https://www.securecoding.cert.org/confluence/x/gAU[CERT, EXP40-C.] - Do not modify constant objects
* https://www.securecoding.cert.org/confluence/x/ZYAyAQ[CERT, EXP55-CPP.] - Do not access a cv-qualified object through a cv-unqualified type


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
