becuase the second is a tricky b@$tard!
Originally Posted by Sebastiani
X anX; // constructs an object of type X, right?
X anotherX(); // does the same, just explicitly calls the default constructor, correct?
what if I type
I didn't actually believe this until I tried it. Scott Meyers calls it "C++'s most vexing parse"
X getX(); // obviously a function declaration returning X
// NOT A INSTANCE OF AN OBJECT!
BTW you can get around this, by requiring functions with no arguements to take void in your coding standard.
I actually think there should be a compiler switch to require this, at least as a warning.