This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Of Bounties and Mercenaries


Stephan T. Lavavej wrote:

Recently I was discussing with some friends how to implement Huffman
compression.  When a Huffman tree is being constructed, "available" nodes
are kept in a pile, and nodes with the lowest weight must be repeatedly
removed, while new nodes are inserted.

After a bit of thinking, we arrived at this:

std::priority_queue<Node *, std::vector<Node *>, boost::function<bool (Node
*, Node *)> >
available_nodes(*_1 > *_2);

Now, that's certainly... subtle, but it simplifies greatly the following
code.

[ Sorry coming into this debate four days late ]


I didn't even parse this code, though I have "Accelerated C++" by Koenig & Moo - I was hit by the obvious: the adjective "subtle".

I have worked on too many programming projects with multiple contributors over the last 20 years, and the one thing you *do not want to have* is subtility.

Everything in the code has to be blatantly obvious, or else one of your coworkers is going to misinterpret it.

No amount of commenting is going to offset that.

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]