Dangers of C++ (Way off topic)

Markus Kohler markus_kohler at hp.com
Thu Apr 29 10:05:25 EDT 1999


>>>>> "Paul" == Paul Duffin <pduffin at mailserver.hursley.ibm.com> writes:

    Paul> William Tanksley wrote:
    >>  Let me expand a little on the dangers of C++.
    >> 
    >> - virtual functions.  It shouldn't be my job to tell the
    >> compiler when virtual lookups are the only thing to do; the
    >> compiler ought to be able to tell.  For performance gurus, a
    >> way to hint to the compiler that virtual lookups were _not_
    >> needed might be useful -- but what if the programmer was wrong?
    >> 

    Paul> How can the compiler tell ?

What William means (I think) is that the default should be that functions
are virtual. Since even virtuals functions can be inlined this makes sense. 

    >> - inline functions.  Again, a good compiler HAS to make this
    >> decision for itself, and in a good compiler, whether or not
    >> this decision was made should be transparent to the programmer.
    >> 

    Paul> A good compiler will, inline is only a hint to the compiler,
    Paul> the compiler can choose whether or not to inline that
    Paul> function, it can also choose to inline other functions which
    Paul> have not been marked as inline.

[agree with all the other points]


Markus

-- 
Markus Kohler  mailto:markus_kohler at hp.com




More information about the Python-list mailing list