Re: C++ & Templates was Re: Question about programming techniques



On Fri, Jun 26, 1998 at 11:10:44PM -0700, Miles Egan wrote:
> I suppose this really isn't the place for this discussion, but I just have
> to say that all of my experiences with the STL have been extremely
> positive.  I've gotten a lot of mileage out of the vector, list and queue
> classes, and the map class is EXTREMELY handy.  Performance hasn't been an
> issue at all and I haven't observed any serious code bloat ( this is with
> Visual C++, unfortunately, maybe things are different with gcc ).

well ... probably templates are ok if used in moderation ... but then you're
not really saving all that much typing anyhow ...

templated code is also not all that much fun to debug ... I'd rather debug
code using the more calssical C containers using void* with no type safety,
then templated code ...

> Constructors and references can be a little bit confusing, I'll agree, but
> you're going to have to initialize your data sometime.  Why not let the
> computer do it for you?  That's the kind of thing computers excel at.  It
> may take a bit of work to get it right in the first place, but once you
> do, it's all automatic.

well .. the problem is that a lot of sxtuff in your code depends on when 
the constructor happens ... C++ is a low level language ... so it's pretty
easy to mess up with constructors ...

I don't like C++ because it is low level but tries to do "magic" on certain
things

you won't have problems with constructors in the high level languages
usually ... because they protect you from "breaking" the magic of the
compiler ... C++ does not ...

anyway .. for a nicely bloted templated code (the code is not that large,
it just uses templates ...) look at mico ... and looka t programs that are
unfortunate enough to be linked with it ... especially look at the
executable size and memory footprint ...

for another experimet .. try using an STL list .. and a glib list ...
compare those two programs on memory footprint

George

-- 
------------------------------------------------------------------------------
George Lebl <jirka@5z.com> http://www.5z.com/jirka/
------------------------------------------------------------------------------
  The following implements RSA in perl and is illegal to export from the US:

          #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
          $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
          lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)



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