Re: C++





On Sun, 19 Apr 1998, George wrote:

>exceptions are rarely used well, plus since it's harder to use then say
>returning status from a function .... most people don't catch them ...

Error handling using status returns is a *VERY* poor alternative to
structured exception handling - they can be ignored causing the program to
limp along in an indeterminant state and crash somewhere else.  BTW - if
you don't catch an exception the program stops.  Much better.  Not to
mention stack unrolling.

 >plus I don't think C++ needs all the extra syntax forall this... look
>at ObjectiveC ... it does more then C++ with less syntax ...

You mean extra keywords?  Any its reallyt not clear what ObjC does better
than C++ - its not even OO - its Object Based - like Ada.

>you need containers ... so why not use say glib which has nice containers
>for standard types ... I have much less trouble passing around (void *)
>then templates ... but then again C++ doesn't like (void *) (it thinks
>it's evil and one must go wild with casts)

No, No and No.  Void*'s are evil and precisely why C is a shockingly
unsafe languarge - you can cast anything to anything and thusly circumvent
type checking that the compiler ican do so much better than programmers.
C++ is better - you can't cast away const-ness (except with  const_cast<>)
and dynamic_cast is a type-safe way of casting.

Also your comments regarding containers - as soon as glib comes as close
to the richness of function of the StdC++Lib then lets talk - at the
moment its a library of utility functions.

>plus most C++ programs use char* for strings still ... I find char* more
>flexible, faster and more memory efficent for most uses ... and as long
>as there are good string functions available you can do whatever ...
>and dynamic strings are possible to ... look at GString in glib ...

Look strings (not char*'s - these are arrays of characters) are data types
and not a collection of functions with char*'s.  To seriously make
comparisons between the StdC++libs string type to GString is a matter for
study.

>reference counting pointers are also not hard in C ... (about as easy as
>in C++) ... it takes about 2-3 short functions and an internal structure
>with a void * and a refcount integer ... but it's usual that you implement
>reference counts not on pointers but on the object itself ... such as in
>gtk

Well it looks like that its  2-3 short functions and an internal structure
with a void* and a refcount integer more complicated than C++.  The C++
auto_ptr is an example of simplicity and efficiency.

>C++ uses inheritance mostly to create new gui components ... which I
>usually find most irritating .... just to create a dialog with some
>insides you have to create a new class? .. I was once forced to do
>windows programming in borland's object framework and I was not happy
>... (for all I know it might have been easier then straight windows
>rpgramming as I have never done that) ... but it was definately not
>as easy as gtk ... even motif seemed far simpler to use then that ...

The example you give is a *VERY* bad one.  Inheritance for new GUI
function is what novices do (not to be unkind).  To condemn C++ becuase of
poor framework design is disingenuous to say the least.  For examples of
this see IBM's OCL and ET++ as well as the 1.1 version of the AWT.

Bruce McDonald



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]