Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

PC-Lint and VCL Components

PC-Lint and VCL Components

PC-Lint and VCL Components


I am trying to set up PC-Lint for Borland C++ Builder 6.  I find that I am running into a problem as follows:

If I use the VCL components and "drag and drop" textboxes and the like onto a form (using the "IDE managed code") I get errors while linting telling me that the variable is undeclared, unknown return type, etc.

If I instead, do all the work myself of instantiating the textbox, assigning positions, etc in code PC-Lint does not issue complaints.  As best as I can determine it seems to be that the "IDE Managed" components have the source code hidden away.

My question is - how can I get source code output for these IDE managed VCL components (I don't have an option to lint the object files - only the source).

I have a large amount of legacy code to support that has already implemented the forms "visually" so re-writing everything "by hand" is not a viable option.

RE: PC-Lint and VCL Components

I mischaracterized the problem.  I don't believe I need the output from Borland.

I looked deeper and found that pc-lint is not having a problem with the way the objects are instantiated but rather it has a problem understanding a method called on specific types of VCL components (IndexOf(), Add()).  I need to search further to figure out what is going on.

RE: PC-Lint and VCL Components

Is it possible that you original an VB programmer?
I don't understand very well your question.

But I suppose the solution to your problem is Dynamic cast. With dynamic cast you can use the same code for all your vcl components. This is not possible with VB( at least about 10 years ago it wasn't). Therefore I guess you try the VB manner with C++ Builder.

RE: PC-Lint and VCL Components


Actually, I am originally a C programmer and have learned C++ on the job.  I have dabbled in VB though.

The problem I found is that Borland C++ Builder does not use the __property keyword in a C++ standard manner.  PC-Lint has an issue with such declarations as can be found in the Stdctrls.hpp library header files.

TCustomCombo has a line that states:
__property Classes::TStrings * Items = {read=FItems,write=SetItems};
This is inherited as is in a TCustomComboBox and can be understood by PC-Lint with no complaints.  However the TComboBox class which inherits from TCustomComboBox restates Items as follows:
__property Items;

Where the header file is using __property in a non-standard way (I believe) and this is where PC-Lint begins complaining and issuing forth errors.  If I comment out the line in the library header file the TComboBox pulls the Items declaration from the original TCustomCombo declaration and PC-Lint is happy to accept the code with no errors.  Borland, therefore, seems to use the __property keyword in a non-standard way where the compiler "knows" what an "Items" is.

At this point, I don't believe I can get any help with the issue from anyone other than Gimpel (PC-Lint developers) because I don't beleive there are any "tricks" one can use to get PC-Lint to understand the header files properly.

RE: PC-Lint and VCL Components

Remember that many VCL components of C++ Builder are written in Pascal (Delphi). Maybe this cause your problems?

But it is only a guess. I have no knowlege about PC-Lint

RE: PC-Lint and VCL Components

No, actually that is not a problem because VCL uses C++ class "wrappers" and typedefs for all the Object Pascal.

FORTRAN users use PC-Lint by employing C++ wrappers in a similar manner.  PC-Lint only handles C and C++.

At this point I tossed it back to the developers and hopefully I'll hear something back from them because I found PC-Lint to be quite useful for finding hidden errors in legacy code (and even some of my own goofs).

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close