Is it considered good style to dereference `new` pointer?
问题 To avoid keep having to use -> and instead work directly with the object, is it acceptable practice to do: obj x = *(new obj(...)); ... delete &obj; 回答1: This is not just poor practice, but: Leaking memory (most likely, unless you are using some pattern that is not visible from the code you provided), since obj will store a copy of the original object created by the new expression, and the pointer to that object returned by new is lost; Most importantly, undefined behavior , since you are