On 1/5/2012 1:03 PM, Manu wrote:
    That is the case with overriding a non-virtual function - the compiler will
    compile it anyway, and most of the time it will work. That's what makes it
    so eeevil.


I saw today, or last night, someone suggesting a keyword to make non-virtual
override explicit, and error otherwise. Which actually sounded like a really
good idea to me, and also addresses this problem.

That's correct, it does address it. But not for C++.

    The right thing should be the default.
But I fundamentally disagree your choice is 'right'..

Sure.

This is obviously subjective, so I don't think that's a fair assertion.

By 'right', I don't necessarily mean 'the most efficient'. I mean that the code should be correct. It's ok if extra work is involved in creating the most efficient version. For example:

    int a;

automatically initializes a to zero. This is correct. If you want it to remain uninitialized,

    int a = void;

which will be faster in the cases where the compiler cannot optimize away a redundant initialization of a. But, it is dangerous because the compiler cannot always prove that a is initialized before use, hence it is not the default.


But as I've previously said, I understand this can't change now, I've let it go 
:P

I understand, I'm just explaining my point of view, and you're just explaining yours.

Reply via email to