I am looking at some legacy code and came across x=new(Foo); (note the parenthesis around the type supplied). I tested out variations and it appears to be the same as x=new Foo;
Foo is a non-POD data structure. Some external memory leak program is flagging the line – it’s allocating memory for a CORBA out parameter so the caller should be taking care of the delete but that is a separate issue with many layers of indirection.
Is my analysis correct and is it acceptable style?
If the name of the type has parentheses it must be enclosed in parentheses. Other types may be enclosed as well.
Example where parentheses are required:
From cppreference.com: new expression