The Joel on Software Discussion Group (CLOSED)

A place to discuss Joel on Software. Now closed.

This community works best when people use their real names. Please register for a free account.

Other Groups:
Joel on Software
Business of Software
Design of Software (CLOSED)
.NET Questions (CLOSED)
TechInterview.org
CityDesk
FogBugz
Fog Creek Copilot


The Old Forum


Your hosts:
Albert D. Kallal
Li-Fan Chen
Stephen Jones

xrefs

Hi folks,

this is another of those threads asking for recommended software and ideas.  Sorry.

Anyone know a good program to create good C++ cross-references (i.e. a searchable database of all the types, methods, where they are declared, where they are used, etc)?

I've tried a few but they don't grok C++; they might tell you that 'Externalise' is a method, but will just give you a long list of all the methods called Externalise.. and that might be quite a long list!  For any given method in my sourcecode, I want to be able to jump to the actual implementation it represents.  I need C++ grokability!  Scoping and understanding namespaces etc etc.

(A google seems to lead me to believe that there isn't really anything obvious, infact there are sites bemoaning the lack of one.  And GCC had a --xref switch, but it is deprecated now.  Arghh.  Compilers know all this stuff; a browser that used debug info from a compiler would be grand.)
i like i
Thursday, October 14, 2004
 
 
"Understand for C++" (www.scitools.com) does this internally.  It also provides a Perl interface to its database so you can write your own reports.

It's around $500 for a single license.  It can ingest an entire subdirectory structure of code, and allow you to browse classes, objects, routines.

It also has a graphics component to show call structures, and declaration graphics.

Highly recommended.
AllanL5
Thursday, October 14, 2004
 
 
> For any given method in my sourcecode, I want to be able to jump to the actual implementation it represents.

This functionality exists in the MSVC IDE. I met someone who prefered the MSVC IDE, even for editing Linux code, because the IDE is good (caution: this "Browser" feature doesn't work unless the source code is compilable ... though it doesn't need to be linkable).

Apart from MSVC, you might find this functionality in other C++ IDEs.
Christopher Wells Send private email
Thursday, October 14, 2004
 
 
"This functionality exists in the MSVC IDE"

within the current project.  Can it cope with really big code repositories covering many many libraries etc?
i like i
Thursday, October 14, 2004
 
 
Not sure what platform you're on, but since you mentioned gcc I'll assume non-Windows.

C++ IDE's often use the ctags information to peruse the references as you mentioned. KDevelop is capable of using it, many others do as well.

There are also stand-along apps for this, a googling picked up this;

http://www.home.earthlink.net/~jebrooks1/hypersrc/
Nigel Send private email
Thursday, October 14, 2004
 
 
> Can it cope with really big code repositories covering many many libraries etc?

I'd say 'yes': when I have multiple "projects", I put them all in the same "solution" ... so that I can compile and edit them all from within the same IDE instance. I haven't tried the MSVC++ v7 browser, but the MCVS++ v6 browser worked fine on a solution that contained two or three dozen projects and several 100KLOC.

I think you use <Alt><F12> to bring up the browser window. You can then search for where an identifier is defined, or the places from where it's referenced. You can search for identifiers such as "MyClassName", "MyClassName::MyClassName" (i.e. the constructor), "MyClassName::*" (all members of MyClassName), etc. You can also for example right-click on an identifier in the code, and select "Go to definition" on the popup menu.
Christopher Wells Send private email
Thursday, October 14, 2004
 
 
The MSVC v6 browser wasn't very aware of namespaces, however.
Christopher Wells Send private email
Thursday, October 14, 2004
 
 
Source Insight does a reasonable job of this, after a brief investigation. It's an editor that understands C++ (and Java too, I think):

http://www.sourcedyn.com/index.html (trial version available)

Source Navigator will also do this for C++, but I didn't like it that much:

http://sourcenav.sourceforge.net/ (free) (unix too)

I nixed both the above because I'm a long-time regular user of Visual Assist (an addin for Visual Studio) that will also do this kind of thing, in addition to tarting up the default intellisense. I'm hesitant to recommend this one unreservedly, because it's definitely not perfect, but I find it useful enough to put up with its flaws:

http://www.wholetomato.com/ (trial version available)

And of course, Visual Studio's browse information will do this for you, but in my experience with mixed results.
Tom_
Thursday, October 14, 2004
 
 
I'm surprised no one has mentioned vi/ctags.  It's an awesome way to navigate function declarations/calls.  Move to a function call and hit one keystroke to go to that function's definition (no matter what file it's in), one keystroke takes you back.  It groks C++ among 33 others.

http://ctags.sourceforge.net/languages.html
eden li
Friday, October 15, 2004
 
 
Thanks everyone for the ideas.  I should have been clearer - I have an absolutely mind-numbingly massive code-base in so many modules that it isn't feasible to load it into an IDE - they aren't designed for that kind of thing.

What I really want is the type of xref that takes a massive codebase and makes a database from it, probably with a web-front-end.  There are such things that bolt onto SCS like CVS etc, and versions that scan folders and whatnot.  Unfortunately, they had better really understand C++, rather than being a fancy regex suite - all the regex stuff google found only works on a very small subset of C++ it seems.

The compiler knows everything, so if there was a debug format that listed the actual resolved symbols then maybe I could build a tool on to of that?  I really want it bad enough to be prepared to code a bit for it!  But writing my own C++ parser?  Not so viable...
i like i
Friday, October 15, 2004
 
 
Try Cscope:

http://cscope.sourceforge.net/

I program almost exclusively in C++ and use Cscope and Exuberant Ctags (mentioned in eden li's post) with Vim, and have become extremely efficient with this combination.

If you prefer, there's a Tcl/Tk interface to Cscope called Cbrowser:

http://cbrowser.sourceforge.net/
Mike Bland Send private email
Friday, October 15, 2004
 
 
Who mentioned ctag first? ;-)
Nigel Send private email
Friday, October 15, 2004
 
 
Ah yeah.. you did Nigel.  I just skimmed over the thread looking, not really reading it.  Guess I shouldn't do that if I'm going to post.  Sorry! :)
eden li
Friday, October 15, 2004
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz