lundi 29 décembre 2014

C++11: Difference between Test* test = new Test; and Test* test = new Test();

Under C++11, if 'Test' is an ordinary class, is there any difference between:



Test* test = new Test;
//and
Test* test = new Test();


Note: this is the same question Do the parentheses after the type name make a difference with new? asked again, because the old thread is before C++11, while I'd like to ask if there's a difference under c++11 stadard.


The accepted answer of that question says:



  • In C++1998 there are 2 types of initialization: zero and default In

  • C++2003 a 3rd type of initialization, value initialization was added.


I understand that C++11 only has 2 initialization, default and value. So i fancy the answer are a bit different?


Aucun commentaire:

Enregistrer un commentaire