#15 line number of *start* of declaration


function(int x);

> ctags --excmd=number --c++-types=p -f - temp4.h

function temp4.h 2;" p

As you see, ctags is outputting line number 2 instead
of 1. There should definitely be a way to make ctags
output the line of the beginning of the declaration,
especially because when processing ctags output in a
program it's easy to go from the beginning to the end
even without a real parser but going backwards and
finding the start of the declaration is very hard to
implement (especially if you process files 1 line at a
time in an awk script as I'm doing right now).


  • Darren Hiebert

    Darren Hiebert - 2002-12-21

    Logged In: YES

    Ctags records the line on which a given name is defined, not
    the statement which defines the name. I cannot agree that
    this suggestion is useful in general. In my own use of
    ctags, I want to go to where the name is found.

    Secondly, the ctags "parser" is not a real parser, but a
    crude parser which is very imprecise, partly because of the
    problems caused by macros (which often result in
    syntactically invalid code), which would break a real
    parser. It would be too much work to make ctags work this
    way. Further, if I did, it would never be completely correct
    because of macros.

    It seems too much work for me to engage for limited benefit.
    You are welcome to see what you can do, though, since ctags
    is licensed under GPL.

  • Darren Hiebert

    Darren Hiebert - 2002-12-21
    • status: open --> closed-rejected

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks