Possible Duplicate:
Do the parentheses after the type name make a difference with new?
In some code, I recently saw a struct like this:
typedef struct MyStruct {
int numberOne;
int numberTwo;
} MYSTRUCT;
Later, I tried instantiating one of these structs using
MyStruct *pStruct = new MyStruct();
which worked fine with Visual Studio 2010, but failed with an obscure linker error on a different compiler. It took a while until we found out that omitting the braces like this
MyStruct *pStruct = new MyStruct;
solved the issue.
So, what exactly is the difference between these two invocations and which one is the right one to use?