It happened again.
I have many cases of modules with something like #ifdef TYPEA ... many lines #endif #ifdef TYPEB ... many similar lines #endif #ifdef TYPEC ... many similar lines #endif
It happens that I am looking at the type b code trying to figure out something in type a (the codes are VERY similar).
To avoid this, I have tried
blah,blah // comment TYPEA
and that "kind of works"
Now, the ideal would be if for type a I could do the following: #ifdef TYPEA #define ATYPE #define BTYPE // #define CTYPE // #endif
and then just make it ATYPE blah,blah // comment
Of course this does not work. Does anyone have a trick that makes this possible?
Erik
Knowing that little bit more, I'm going to suggest not altering the code and instead using a source code analysis, browsing, and reverse engineering tool that has the (configurable) ability to ignore inactive code. With this kind of tool, you have it go through the code with the same TYPEA/TYPEB/TYPEx setting that you are currently using and it will record references (var read, var modified, func calls/callby, etc.) only where that TYPEx setting is active. In fact even for unrecorded references, it can search while ignoring inactive code, or only in comments, only statements, or only strings.
See scitools.com/.../features.php
It is for C too, in fact that's how I use it. I don't use its editor, but instead, have added a toolbar button so that when I have found the area of interest, I click the button and it brings up the file in "my favorite editor" with the cursor position at the identical location.
I have used this tool to try to understand the intricacies of client code >500,000 lines over hundreds of source files with approximately 80 #ifdef build/feature options, but I use it for small projects too. It just makes things so much faster. You probably owe it to yourself to use their evaluation for awhile to see what I mean.
thanks, Dan You probably owe it to yourself to use their evaluation for awhile to see what I mean. will do next time this hits.