Pointers

Nobody Understands C++: Part 6: Are You Still Using Pointers?

It is best to avoid using pointers in C++ as much as possible. The use of pointers can lead to confusion of ownership which can directly or indirectly lead to memory leaks. Even if object ownership is well managed simple (and difficult to find) bugs can also lead to memory leaks.

Security Risks

Also, by avoiding the use of pointers we can avoid and sometimes eliminate common security holes such as buffer overruns. See the last example for more information about this.

Examples

Common instances were pointer usage can be avoided:

Syndicate content