TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: PIERRE PHANEUF
from: WIM VELDHUIS
date: 1997-04-19 18:26:00
subject: Rating of C++

Pierre Phaneuf wrote in a message to Jerry Coffin:
 PP> This is crazy. Like those so-called "keywords" for
 PP> casting... Since when am I supposed to see "dynamic_cast"
 PP> and recognise this as a KEYWORD for chrissake??? Looks like
 PP> a damn Pascallian variable name! ;-)) 
I do not think Pascal is better in that context. The pascal syntax structure 
"x AS TForm" is equal to the dynamic_cast. Both use a special word for it. 
However 'as' is also used as an abbreviation of 'array of strings' under 
hungarian notation. Are you still able to declare a variable with the name 
as ?
 PP> One of the suggested "fix" for the "= 0" is to "add" a keyword 
 PP> like this:
 PP> #define abstract = 0
Depends on your viewpoint. You define a new keyword, they used existing 
syntax. Now at least you can still use the word abstract as an identifier.
And if you like, you can do it your way as well. Sounds pretty flexible to 
.
 PP>> Also, *not* having multiple constructors,
 PP> TThisObject = object(TObject)
 PP>     constructor Init;
 PP>     constructor Load(S: TStream);
 PP>     procedure Store(S: TStream);
 PP>     [...]
 PP>     destructor Done;
 PP> end;
C++ :
class TThisObject : public TObject {
  public:
    TThisObject();              // default ctor
    TThisObject( S : TStream ); // constructs from stream
    ~TThisObject();             // dtor.
};
This is definitively possible. In C++ you cannot however declare a 
constructor virtual. I currently program in Delphi and there all form derived 
classes are default created using the virtual Create( AOwner : TComponent ) 
ctor. If you define a new derived class you do not have to redefine the 
constructor (ctors are inherited). In C++ this is not possible. There are 
advantages and disadvantages to this approach. 
Advantages are:
1. You do not have to write ctors which only call ancestor methods.
2. You can easily create forms (Like in the TApplication.CreateForm function)
Disadvantages are:
1. You cannot redefine a virtual constructor with a different parameter list.
Of the advantages, 1. does not often apply as usually derived classes have 
new attributes which should be initialised anyway. Advantage 2. can with some 
extra coding be achieved without virtual constructors.
The disadvantage is however quite large for larger projects. If somebody 
calls the inherited ctor by accidence, your object is incorrectly 
initialised, without you noticing it until run-time where it usually takes 
some time to find.
[about MI]
 PP> I have yet to see a case where I'd *REALLY* need it.
It is like Jerry said, you not often use it, but if you need it there is 
almost no way around.
Putting it all together leads to the conclusion where you say is Pascal is 
better because you know it. C++ is a different language with different 
strengths and different constructions to obtain certain results. These 
constructions might not always be the most comprehensive, but they work.
Comparing Pascal and C++ is like comparing apples and peaches. They don't 
match.
Both languages have their own characteristics. My advice is to learn them and 
use them to your advantage. There are cases where Pascal is better and there 
are cases where C++ is better.
mvg/wr
  
--- timEd/2 1.01.g3+
---------------
* Origin: LightHouse BBS ==> I am a H.U.G.O. Member ! (2:285/324.3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.