21 Jul 2000 steved   » (Journeyer)

I've just been reading mettw's diary entry on C++, and I'd like to make a few a comments (shame we can't do reverse links):

After getting used to C++ for dbXML I really can't understand why anyone would want to use it. It's an inefficient garbage bin of features.

Inefficient? Can we have some examples here? Sure, if you declare all your methods virtual, you're going to take a hit on the double indirection for each call. So don't do that. Use virtual only in places where you'd use function pointers in C. There's a more general point here, I think. You can produce unreadable, inefficient piles of cruft in C++, and it may be easier to do than in C. But I think with careful and thoughtful design you can also write easier-to- read code in C++.

While debugging it I saw the number of lines it had to go through just to pass a string object to a method - You really have to see it to beleive it!

I assume you're talking about lines of assembler generated here. Do you mean a pointer to the object, or the object itself? More to the point, can you demonstrate that your compiler's (possibly) lousy code generation is a result of flaws in the design of the language?

I can understand going through that many lines with a higher level language, but with C++ being so low level you really have to ask what the point of the language is. With C++ you get the bloat of higher level languages with the pain in the arse debugging of C.

I'm not saying you're wrong, but I'd rather see some more detailed reasoning here. If you believe the generated code in your example to be inefficient, is this the fault of the compiler, the language standard itself, or the author of the code for not understanding the implications of what he/she was doing?

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!