Tools for Analyzing C++ Class Code Generation?
Milo_Mindbender submits this query: "I've got a midsize Linux project which uses a lot of STL and other C++ template code. Even considering this, I end up with a lot bigger text (generated code) segment than expected. I know the information about the amount of code generated for each class is in the objdump, but prying it out by hand is a problem when you get five line long template invocations and hundreds of methods to wade through. Can anyone can recommend some tools that analyze binary or objdump output and summarize the amount of code generated for each class, including each unique template or STL class?"
"Why you shouldn't use OOP for anything important."
I've had enough abrasive sigs. Kittens are cute and fuzzy.
Our large corporation also has a project, a client has requested that we implement BubbleSort, QuickSort, ShellSort, and one other sort that we learnt in cl^H^H^H^H^H^H^H^H^H err, discussed in a business meeting. The err, client also requests a 1 page analysis comparing and contrasting the differences between the searches.
Can code generation do this? It could really increase my chances of a good mar^H^H^H err profit yeah.
For each additional programmer involved in the project, double the contents by stirring in a random different kind of Visualization Tool.
If you're targeting multiple architectures with different STL implementations, the Visualization Tool can be enhanced by having the lead of each platform boil their own pot of Visualization Tool, and then throwing the still-boiling contents at the other chefs^W developers.
If you aren't clear as to where I'm headed, I'll next recommend a more painful exercise: Go ahead and try debugging somebody else's template-heavy code.
Use a map or a hash. Oh, and lastly, move all the code in headers out into the .cxx/.cpp file, your code will compile faster, and probably run nearly as fast, with the exception of a handful of performance critical classes (finding them is important).
Kirby
Search at source forge for Open C++ or OpenCPP, not sure how it is written.
That is a programmable source to source transformer for C++.
It spits out one singel file of c++ for every compiled C++ unit, removing the includes, by expanding them into the output.
That way yo can source level debug the processed c++ code, not exactly what you want but likely more powerfull in the long run anyway.
Your request varies far to heavy from compiler to compiler.
angel'o'sphere
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
If you do not already have a copy of Large-Scale C++ Software Design by John Lakos, get it. I realize this isn't a tool per se, but he has a terrific section in chapter 10 on Using C++ Templates in Large Projects.
This is more of a suggestion than a debugging tool but...
You didn't say which compiler you were using but, for example, with a recent g++, try turning off some of the inlining and turn on -frepo. This will make sure that, for example, there is only ever one copy of map::find.
I don't know; maybe the latest g++ does a good job of this already.
It is kinda ugly for what it does but it works. Only one instantiation of std::vector is made, it is void*. Putting the member function definitions in the header file ensures they will be inlined if necessary.
I think Scott Meyers came up with this tip first.
Just wanted to bring your kind attention to this amazing fact: everyone tries to handle STL code bloat, is looking for a (inexistent) STL debugging tool, suggests to completely re-design compiling principles just to make STL compile a bit better, writes books about good STL coding (how to make your binary 3 times smaller), rends the air by saying "do you know what 'S' means in STL????" (one of slashdot postings)...
So why use it at all? Just because it is standard? Then go program with Fortran or Ada, they are pretty standardized, yet almost completely useless/impractical. And so STL.
(Ah... forgot this: IMO, IMO, IMHO, IMVHO, IMVVHO)
Huh? No?
I've seen template bloat in a lot of places, but MI bloat?
Just because something can be done in the language doesn't mean everybody just goes and uses it. You're right that MI is too prone to mistakes, and it can be replaced most of the time by java-like interfaces.
I use C++ because is deterministic, can be used to really big proyects, when it runs is fast as hell (can be faster than C when using inline functions), and because I don't use every shitty feature of the language just because it's there. The right tool for the job can be a subset of C++.
We are Turing O-Machines. The Oracle is out there.