== Why is this an issue?

Pointers are a powerful tool, but they can be difficult to use correctly, leading to memory leaks and double deletion. Further, they're not usually needed in {cpp} because the language offers abstractions that handle the more difficult aspects of using pointers for you.


=== Noncompliant code example

[source,cpp]
----
int *pi = new int;
int *parr = new int[1024];
char *str = new char[1024];
----


=== Compliant solution

[source,cpp]
----
int i;
std::array<int, 1024> arr;
std:string str;
----


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

=== on 30 Jul 2014, 20:14:20 Freddy Mallet wrote:
I expect this rule to be really controversial and to generate a lot of noisy discussions. But if we decide to go ahead :

* By definition this rule should not be activated by default otherwise at least half of the {cpp} users evaluating the SonarSource plugin will consider the plugin has valueless because generating a lot of noise. 
* I would decrease the severity to "Major" and classify the rule in the "Maintainability" category.

endif::env-github,rspecator-view[]
