LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

When will CVI support a C++ compiler Natively?

I tend to agree, with the kind of work we do here for the most part, secure code isn't a must, idiot proof code is.   This might be the way to go.
 
Hey I have an actual CVI question now :-P.  I've got a generic handles linked list module that I wrote in about an hour, but I wanted to wrap it up all nice and pretty for the department, right now i'm having to physically add the c file as part of the project, is there any way to implicitly (or explicitly) say when you include the header, silently grab this C file as well? this is essentially how CVI's internal libraries are used right? now if I wanted to share this with others, what's the best way to go about this?

Message Edited by DanielGreen on 10-30-2007 11:35 AM

0 Kudos
Message 41 of 48
(2,083 Views)
The metric in this tool is open to criticism.  Author says it's based on the metric Steve McConnell uses, and he's influenced by Tom McCabe's which is the best known maybe.  He never states eactly how he does it.

Yup, it adds a "decision point" (complexity point) for each case in a case statement.  Sounds like this contributed a lot to the 847 score.

Other people count function points.  You can become a certified function point counter if you like.  http://www.ifpug.org/

Code with a timliness requirement doesn't report accurately using function points.

But dang, 847 is an impressive score.

I asked for the text folding a long time ago, NI claimed they are doing something in that area.  Maybe they appease the users a bit without having to mess with the compiler, which they seem loathe to do.

Java, C#  do pretty well.   C# is a full blown Java rip off IMHO.  You're going to have a virtual machine of some kind with these, though the real time specification for Java tries to deal with timliness.  After coding in those you get impatient with hacking gobs and gobs of C.

Menchar




0 Kudos
Message 42 of 48
(2,074 Views)

This is a simple linked list implementation using unions to hold ViSession, panel handles and other forms of CVI handles, it is a module, but the doesn't mean it's not a well designed piece of code, I wish I could share this but as I wrote it for my company I can't for obvious reasons, however I can offer advice to anyone trying to do the same.  Simply put it takes a key and replies with the value in the union.  Please note the metrics, this is very clean code, but looking at it on paper (or screen) is very complex, just goes to show you tho good code can be very effective.

 

Parameter    Value
=========    =====
Project Directory   C:\Project Files\handles\
Project Name    handles
Checkpoint Name    Baseline
Created On    30 October 2007, 3:53:49 PM
Files     4
Lines     421
Statements    199
Percent Branch Statements  23.1
Percent Lines with Comments  14.5
Functions    16
Average Statements per Function  14.9
Line Number of Most Complex Function {undefined}
Name of Most Complex Function  Handles_Set()
Complexity of Most Complex Function 12
Line Number of Deepest Block  {undefined}
Maximum Block Depth   5
Average Block Depth   1.37
Average Complexity   6.50

--------------------------------------------------------------------------------------------
Names of 2 Functions   Complexity, Statements, Max Depth, Calls

Handles_Set()    12, 25, 5, 9
main()     1, 20, 1, 16

--------------------------------------------------------------------------------------------
Block Depth    Statements

0     50
1     73
2     44
3     20
4     9
5     3
6     0
7     0
8     0
9+     0
--------------------------------------------------------------------------------------------

0 Kudos
Message 43 of 48
(2,056 Views)

So no one is willing to step up to the plate with a higher complexity score?   

I have to say that 847 sets the bar very high - it's double the highest score we have.

Ian W provided both comic relief and he got a five star rating for his trouble.   Robot wink

I had a messy Java module that was part of a compiler we were writing in grad school.  Prof made fun of it in front of the class for being shabby - deeply nested, long, etc.  He had an elegant solution that used a JTree.  Then I pointed out that his solution didn't properly handle one of the required scenarios and that mine did.   

Menchar

Message Edited by menchar on 10-31-2007 11:09 AM

0 Kudos
Message 44 of 48
(2,023 Views)

nobody can help on my source hiding question? reprinted here for convenience:

 

Hey I have an actual CVI question now :-P.  I've got a generic handles linked list module that I wrote in about an hour, but I wanted to wrap it up all nice and pretty for the department, right now i'm having to physically add the c file as part of the project, is there any way to implicitly (or explicitly) say when you include the header, silently grab this C file as well? this is essentially how CVI's internal libraries are used right? now if I wanted to share this with others, what's the best way to go about this?
0 Kudos
Message 45 of 48
(2,018 Views)
if you are using CVI, you may package the whole thing into an "instrument": it is kind of an archive with a .fp extension which contains both the header and the source. if i recall correctly, you may also add "function panels" for your functions into an instrument.

every other way i am aware of needs at least 2 files: the header and either the source code, a static library or an import library for a dll...
0 Kudos
Message 46 of 48
(2,004 Views)

It looks like Ian is going to prevail with his complexity score.  Well done Ian.  Smiley Very Happy

You know, another point with C99 is that they fixed up the handling of IEEE flt pt.  NI has some functions defined, but it's just not as good as direct language support.  And if you're making measurements (generally the point of most CVI applications I would think) it sure would be nice to have the better floating point handling of C99.

Maybe NI could incrementally add C99 features.  If variable length arrays are too daunting, maybe they could add the C99 floating point enhancements.

 

Menchar

0 Kudos
Message 47 of 48
(1,942 Views)
then we won't be able to settle down on what features to add first... personnaly i would prefer non-constant initializers and stuffs like that (but i am not doing many floating point operations with CVI). also i would first have __int64 support fixed, which will hopefully come with the next release.

regarding bad scores, i can't measure the code i inherited from my fellow workmate, because:
- i rewrote a lot of it
- i hate it so much that i just can't open the original project.
but i am sure it would not score that bad ! most of the problem were logic ones (no clear architecture at project start leading to spaghetti code, misnamed variables, copy-paste code, missing or wrong error handling, loads of unused functions...)
0 Kudos
Message 48 of 48
(1,933 Views)