Tamas said:
That logic makes sense. It's really a style issue, a matter of personal
preference.
That's not entirely true. You're all correct that putting empty parenthesis
after the type in local declaration can be confused with a function
prototype, the new expression is very different.
In general, if the () are included in a new expression (i.e. "new T()"),
then the item is value intialized (basically the compiler zeros out the
memory first). If the parenthesis are omitted, and the type is a non-POD,
item is default initialized. If the item is POD type, then state of the
program is indeterminate (and in some cases the program is ill-formed).
So, there's a performance cost to including the () in a new expression, but
it makes the program more likely to be correct.
More info is in the C++ Standard 5.3.4/15.
For gcnew, the CLR always zeros out memory before any constructor runs... so
the difference between default initialized and value initialized isn't any
different.