From: Christian Krüger (christian.krueger_at_pace.de)
Date: 2003-03-06 10:34:05
Hi, > [...] > [C++] > > Or why is it possible to declare a destructor 'non-virtual'? > [...] > > Because it is not always necessary - if you don't inherit > your classes. > There are times where this is usefull. I know that, you know that and the linker should know that too. So why I have to give that hint to the linker/compiler? (The same is true for the 'call-by-value' & 'call by const ref.'-issue...) The whole concept of having RTTI or not is for beginners confusing and for experts a waste of thoughts and should be hidden by the development tools. When somewhere is a 'dynamic cast', the compiler should notice that, and should automatically assign the base class a virtual function table etc. And if there are some 'features' which could not done without speed loss, than they have to be done with speed loss. When I have to write fast code, I can use an other language and maybe should not use the C stuff with classes. C++ is a bad mixture, it isn't clean, plain & transparent. It is neither fish nor fowl. > In fact, you can use C++ as a "C enhanced" when you restrict yourself > to the things that don't have much speed and/or size drawbacks. If you > make sure that the run-time system reflects these limitations, C++ is > nothing more than a more handy C-variant. There are some > efforts in this > area, I think one of them is called "embedded C++". I have to disagree. C++ is not only a question of size and speed. It's also a question of comfort. There are many things which could be done by the compiler & linker that are 'out-sourced' to the programmer. Another example: There is no technical restriction which makes it impossible to call a virtual function out of a constructor if the virtual function restricts member access to base class members (avoiding access to 'not-yet-constructed-members'). In some cases where I need such feature I have to implement 'wild things' to get the desired behaviour... Or 'exception handling': I can declare that a function throws an exception but it isn't checked if there is any 'catch'. This should lead to a compiler/linker-error... Sorry for beeing so off topic. I know, my comments don't change the world, but it helps to let the 'steam' out... ;-) Regards chrisker ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-03-06 10:34:48 CET