ISO/IEC 14882:2003(E) 中 5.3.4 之 15
— If the new-initializer is omitted:
— If T is a (possibly cv-qualified) non-POD class type (or array thereof), the object is default-initialized(8.5). If T is a const-qualified type, the underlying class type shall have a user-declared default constructor.
— Otherwise, the object created has indeterminate value. If T is a const-qualified type, or a (possibly cv-qualified) POD class type (or array thereof) containing (directly or indirectly) a member of const-qualified type, the program is ill-formed;
— If the new-initializer is of the form (), the item is value-initialized (8.5);
A 是一个 Class,权且就当 int 也是个 特殊的Class为例,
p = new A; (1)
p = new A(); (2)
后面的仅仅是多了个初始化,如果有 默认构造函数,(1)就会自己初始化
(2) 是按自己的意愿 来初始化,括号中为初始化的值
new int 的话,会将p所指向的int初始化为0