Hey, I just have a quick question regarding C++ standards and the new operator.
If I have a class with a default ctor:
1 2 3 4
class A
{
A() { /* Do Stuff */ }
};
Does the C++ standard require I use ctor parenthesis with the new operator? What I mean is this:
1 2
A* a = new A; // is this legal?
A* aa = new A(); // or do I have to do this?
The reason I ask is that VS6 apparently errors if you don't include the parenthesis -- someone tried to compile one of my programs in VS6 (which compile fine on VS7+) and got errors due to the lack of parenthesis. I know VS6 is not very standards compliant, but it got me to wondering as to exactly what the standard was.
While on the subject -- what about new[]? Is it even possible to use parenthesis with new[]?
array new only allows elements to be default constructed, therefore parentheses are meaningless (and probably not even allowed, but I'm not 100% sure).