Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下2个两次初始化有什么区别?
class Pod { public: int a, b; }; Pod *p1 = new Pod; Pod *p2 = new Pod();
在第一种情况下,对象未初始化,而在第二种情况下,对象保证为value-initialized,在这种情况下,类型为 POD 意味着零初始化