Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PC-Lint and VCL Components

Status
Not open for further replies.

phiaengr

Programmer
Dec 3, 2009
4
US
Hello,

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.
 
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.
 
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.
 
luckieluc,

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.
 
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
 
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).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top