[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: kdebase/kioslave/smtp
From: Antonio Larrosa =?utf-8?q?Jim=C3=A9nez?= <larrosa () kde ! org>
Date: 2003-04-26 17:09:30
[Download RAW message or body]
El Sábado, 26 de Abril de 2003 14:49, Christian Loose escribió:
> Am Freitag, 25. April 2003 23:45 schrieb George Staikos:
> > On Friday 25 April 2003 15:09, Christian Loose wrote:
> > > I couldn't agree more. This hand-written loop really needs a comment
> > > since it's much less readable than the STL algorithm.
> >
> > Maybe for those who know what the STL algorithm is. I'm willing to
> > bet that a sizable percentage of KDE developers do not know much at
> > all about STL.
>
> That might be true, but I'm willing to bet that it takes the same amount
> of time to understand the hand-written loop or to lookup the meaning of
> std::unique() (http://www.sgi.com/tech/stl/table_of_contents.html).
>
Perhaps with unique, but definitely not with the other methods.
Just compare the STL help with the Qt one.
For example, what does vector::erase return ? You know the answer, I know
the answer, but does everyone knows it ? I'm sure most people don't.
Also, the STL has other leaks in other areas different from the
documentation too, for example, how do you remove an element from a vector
by value ? Or how do you get an iterator that points to an element in the
vector which has a specific value ? You have to iterate through all the
vector, which is not nice at all (if you know any other way to do it, I'll
be glad to hear it :) )
> Besides when you understood that the STL code idiom means remove
> all duplicates from the container then similar code will never need a
> comment. On the other hand the hand-written loop will always take time
> to understand. Especially without a comment *hint*hint* :-)
I think that finding an element is more common than removing duplicates, so
at the end we'll need less commentaries than if we used the STL containers
;-)
Greetings,
--
Antonio Larrosa Jimenez
KDE developer - larrosa@kde.org
http://developer.kde.org/~larrosa/
Premature optimization is the root of all evil. -- D.E. Knuth
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic