Why you’re writing your C++ code wrong

Your coding blunders just crack me up every time.

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off. — Bjarne Stroustrup, creator of C++.

Still Writing C in C++? Why?

Let’s face your C in C++ sandwich blunders one by one.

Still using arrays? Whoah!

Still using malloc and calloc?

Does deleting pointers release the memory always?

Stop calling character arrays with null terminators as strings!

Naming headers

Generics or Templates?

How you should use them?

Including header files in your class headers

Try using modern practices


Numeric Operations

A better way of printing arrays or vectors?

Lambdas and Auto types

Why I didn’t use “using namespace std”

Let’s wrap it up

Metalhead, Apple Sheep, Horrible Guitar Player, and, I use tabs instead of spaces. P.S. — I hate Vim and Emacs.