#52 wrong line number for declarations

closed-rejected
None
5
2002-11-24
2002-11-17
No

------------temp4.h------------
int
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. You can argue whether this is a bug or a feature,
but 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).

Discussion

  • Darren Hiebert

    Darren Hiebert - 2002-11-24
    • assigned_to: nobody --> dhiebert
     
  • Darren Hiebert

    Darren Hiebert - 2002-11-24
    • status: open --> closed-rejected
     
  • Darren Hiebert

    Darren Hiebert - 2002-11-24

    Logged In: YES
    user_id=38016

    Ctags is designed to record the line number at which the
    name is defined, not the line number on which the statement
    containing the definition for the name begins. If this is
    really important to you, I suggest submitting a feature
    request for the capability you desire.

     

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

Sign up for the SourceForge newsletter:





No, thanks