Home > General Development > Exceptional C++ Style: Index TablesExceptional C++ Style: Index Tables Eugenia Loli 2005-04-17 General Development 9 CommentsIt may seem obvious, but clear, concise code benefits everyone in the process. This sample chapter from Exceptional C++ Style explains in detail how clear code enhances productivity at every step of the way, not just for programmers and debuggers.About The Author Eugenia LoliEx-programmer, ex-editor in chief at OSNews.com, now a visual artist/filmmaker.Follow me on Twitter @EugeniaLoli 9 Comments 2005-04-18 3:14 am this might help the debian project out so they can one day release sarge. 2005-04-18 4:47 am It may seem obvious, but clear, concise code benefits everyone in the process.I think that about sums it up… 2005-04-18 12:32 pm On the one hand, this article does well: I like his ideas about simplicity and clear variable naming, etc.On the other hand, it fails: too many iterators, stl classes, containers and concepts.I have just spent the last 6 months cleaning up a disaster of a codebase which used this guy’s conventions. Now, it’s easy to maintain and about 4 times faster.By all means, keep coding this way. Then, I’ll always have jobs cleaning up your messes. 2005-04-18 4:35 pm <blockquote>I have just spent the last 6 months cleaning up a disaster of a codebase which used this guy’s conventions. Now, it’s easy to maintain and about 4 times faster.</blockquote>This guy’s conventions? Do you know who Herb Sutter is?Hint: It’s possible to write unclear and inefficient code in any convention. 2005-04-18 5:27 pm This whole thing seems like a big mess to me, and I consider myself a fairly experienced C++ coder.I quickly skimmed over the examples, and I admit that I did not study the code in detail. But I believe that one should at least have a basic idea of what this piece of code tries to perform. And honestly, I don’t know -Richard 2005-04-22 1:08 am Well, it doesn’t help that the indentation seems to have been lost during the transfer to HTML…If you read the ‘guru question’, you’ll realise that the code is there as an example of flawed code. You’d also read exactly what the code does: ‘The following code presents an interesting and genuinely useful idiom for creating index tables into existing containers.’ That’s pretty clear to me. 2005-04-22 5:23 pm > useful idiom for creating index tables into existing> containers.Explain this to someone who has now idea of computer programming. I’d be surprised, if you succeed.That doesn’t mean I think that general programming concepts have to be understandable by mere mortals, but it certainly helps.I’m asking again: What useful and obvious thing does this code? 2005-04-22 6:46 pm The article is not aimed at someone who has no idea of computer programming – it’s aimed at programmers who already know enough about data structures to understand it. An index works a lot like the index of a book, it’s a means to quickly locate a element in a data structure. Which is very useful.I don’t know about obvious, but I’m not sure why you expect it be anyway. By the way, when did you ask the first time? 2005-04-23 6:23 pm > By the way, when did you ask the first time?I complained earlier that it’s not obvious.So propably it is indeed useful. I just wanted to point out that I cannot agree that this code is clear and concise, although this is what the author claimed it is.