[PyKDE] Re: Learning C++

Frederick Polgardy Jr polgardy at bodacion.com
Wed Aug 13 21:39:01 BST 2003


On Wednesday 13 August 2003 01:53 pm, Simon Edwards wrote:
> I learnt C and asm originally and now I write KDE stuff in C++,
> basically C with classes. Most of C++ is a waste of space IMHO.
> Templates are a disaster, streams are just overrate syntactic sugar
> as they say, and I'm still waiting to see a good example of operator
> overloading that doesn't involve complex numbers or matrix math.
> (String concatination is probably the only other decent use for o.
> overloading).

You were doing so well there until that last paragraph! ;-)

Seriously though, I definitely understand where you're coming from.  The 
more types of automatic things you provide (automatic type conversions, 
automatic operator overloading behavior, automatic copy construction -- 
which may or may not do anything even remotely resembling what you want 
it to do, etc.) the more opportunities you leave for the user of your 
libraries to really muck things up.  It's always better to be complete 
and explicit.

As far as templates go, I'll just say this: it's amazing that such a 
powerful, typesafe, static code-generation mechanism as templates is 
even usable at all -- much less usable enough to provide something as 
robust and (frankly) inspired as the STL.  (Once you get the hang of 
templates, and some of the crazy things you can do with them like 
traits and policies, reading STL code is actually not that bad.)  I 
guess it's just another example of something you can use really, really 
badly, or incredibly well.

Fred




More information about the PyQt mailing list