Why should C++ programmers minimize use of ‘new’?

I stumbled upon Stack Overflow question Memory leak with std::string when using std::list<std::string>, and one of the comments says this: Stop using new so much. I can’t see any reason you used new anywhere you did. You can create objects by value in C++ and it’s one of the huge advantages to using the language. … Read more

Do the parentheses after the type name make a difference with new?

If ‘Test’ is an ordinary class, is there any difference between: Test* test = new Test; and Test* test = new Test(); 7 s 7 Let’s get pedantic, because there are differences that can actually affect your code’s behavior. Much of the following is taken from comments made to an “Old New Thing” article. Sometimes … Read more