Hi, Dan McGregor!
On 18 Jul 97 16:49:38 you wrote to Sunir Shah
DM> and in some cases its not quite as good. (The
DM> classes aren't as fast as C struct's)
Could you prove that? struct is a sysnonym to class, so I think you say is
impossible. :)
SS> /* 1. Passing by reference */
SS> void foo( int& HeyIMagicallyAlterYourVariableWithoutTellingYou )
DM> It can be avoided.
Yes it can. But one who want to avoit it should better stay in C.
SS> /* 4. C-style casts are outlawed as of the latest draft proposal */
SS> long bar;
SS> int baz = (long)bar;
DM> Strange. I use type casts all the time. IE:
DM> char *i;
DM> i = (char *) malloc (30 * sizeof (char));
Is that C++? What about
char * i = new char[30]; // Are you payed a cent per character? :->
Actually in C you can do all the old C casts but also have other options. One
is similar to old cast, just another syntax:
long l = long(myInt); // really looks like conversion function
And the new restricted cast operators. they are ugly to read and write, but
can save you bugs. Have you ever casted away constness unintentionally? Now
this can be cought at compile time.
Paul
... Honest teacher. A virus REALLY did eat my homework!
--- OS/2 Warp
---------------
* Origin: The FlintStones' Cave in BedRock (2:371/20)
|