Open Close Principle

The Open Close Principle in Programming says “Software entities like Classes, Functions, Modules should be open for extension, but closed for modification.” It encourages programmers […]

syntax of main in C/C++ language

In C/C++ language, main function comes in different flavors as shown below: int main(); int main(int argc, char **argv); int main(int argc, char **argv, char […]

Singleton design pattern

Singleton patterns are used, when you want to allow creation of only one instance(object) of a particular class. Such classes (which allow only single object […]

Memory leaks and dangling pointers

Those who use languages like C and C++ that support user defined pointer variables, put utmost emphasis on implementing the pointers correctly. And rightfully so, […]

Find larger of 2 elements without branching

Given two unsigned integers, find the larger (or smaller) of the two without using branching (if-else or conditional operator).

One Definition Rule (ODR) in C++

One Definition Rule (ODR) In C++, declaration does not allocate any memory. Its only when an object (or function) is defined that an instance of […]

Lambda functions and expressions in C++11

In my opinion, the single biggest addition to C++11 is the Lambda function and expressions (for more features in C++ click here…). Look at the […]

Separate nullptr in C++11

In my earlier articles on C++, I have written about the automatic type detection, uniform initialization list and Range based for loopin C++11. Earlier we […]

Range based for loop of C++11 Similar to 'for each'

In my previous articles about C++11 standard I talked about automatic type detection , decltype keyword and uniform initializer list introduced in C++11. Lets see […]

Uniform Initializer lists in C++11

In my previous article about the latest C++11 standard I talked about automatic type detection and keyword decltype Today I will take another major enhancement in C++11 called […]