Re: C++ Versus C (Was Re: Java Versus gtk)



On Wed, 2004-02-18 at 10:44, Tristan Van Berkom wrote:
Michael L Torrie wrote:
[snip]
Clearly that code is not as robust nor safe (or probably even correct)
but I just wanted to show that C can be almost a flexible as C++.  

I'm sorry,
     I know this thread is getting pretty carried away and all,
I'm just surprised that you use the word "almost", in what way
can C++ be more flexable ?

I do believe that syntactic sugar can enhance your productivity and make
code fast and safe.  It's typically a little bit harder in C to maintain
things like generic, type-safe things like lists and hash tables.

In the strictest sense, C is in every way just as flexible and powerful
as C++.  But it's not always easiest.  I guess that's what I meant by
almost.

My point is that gtk, while based in C, is very flexible and powerful,
and can be very safe.  When used properly, the functions defined in glib
can virtually eliminate your memory leaks that otherwise might plague a
C program.

I personally believe that gtk is every bit as powerful as QT and in many
respects cleaner and more portable.  The glib gobject object model is
also clean and the signaling mechanism used by glib gobjects is faster
and I believe better than QT's (no weird moc needed, even on the C++ gtk
bindings).  Using casting macros also ensures that gtk objects are
always safely casted, which provides all of the safety that the c++
object model provides.





Best Regards,
                              -Tristan


PS:
     Maybe I should read some paper on "why was C++ invented", (anyone
have a pointer to that ?) all I've got so far is "to have a C flavor
of OOP *language*", and we already know that we can achive OOP using
libraries and alot of boilerplate code.  When we found out how usefull
<string.h> was; we didn't invent a new compiler.
-- 
Michael L Torrie <torriem chem byu edu>



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