LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Check for reasonable watch expression

Solved!
Go to solution

Hello NI,

 

by accident I have found out that it is possible to add anything as a watch expression... For instance, if the cursor selects a brace, it is possible to add this brace as a watch expression - trying to execute the code then will show a message 'illegal expression' - which is true, of course, but might be confusing if one didn't realize the unintended selection. Hence I'd rather suggest not to permit adding such expressions... After pressing the 'add watch expression' button the CVI IDE should immediately check if the expression is meaningful.

Message 1 of 8
(4,553 Views)
Solution
Accepted by topic author Wolfgang

Hello Wolfgang,

 

thank you for providing feedback, that helps us to improve our products. The best way to make NI R&D aware of such ideas is using the NI Product Suggestion Center. Please post your suggestion there.

 

Thanks a lot and kind regards,

Jochen Klier

National Instruments

0 Kudos
Message 2 of 8
(4,530 Views)

Hi Jochen,

 

OK, I will do so, too. The reasons to report this behavior here in the forum were

1) to check if I missed something simple. In such a case (which occurs, admittedly) it would not be a problem of CVI but of the stupid user 🙂

2) to allow NI filing a CAR if it turns out that the IDE is in need of improvement. For me, such a CAR seems to have a stronger impact on product development and hence promises a more sudden reaction ...

 

Wolfgang

0 Kudos
Message 3 of 8
(4,528 Views)

Hello Wolfgang,

 

I'm not aware of a built-in option to change this behavior, so I don't think you have missed something.

I agree, that changing this behavior would mean an improvement, but still I wouldn't rate it as a bugfix but as a product suggestion. Please be aware of the fact, that also CARs get subdivided into various categories and the category of this issue would probably be "suggestion". This results in the same awareness level like a product suggestion.

NI's R&D activities are significantly driven by our customer's needs and all suggestions are considered seriously to be implemented in new releases, depending on the amount of their positive impact and the urgency.

 

Kind regards,

Jochen

0 Kudos
Message 4 of 8
(4,524 Views)

Hello Wolfgang,

 

The reason why CVI allows you to enter an invalid expression is because you can add watch expressions at any time in CVI. You can enter an expression when the program is not running, and even when it might be in need of compilation. And even if the program is already compiled, and running, your expression might use variables that only come into scope at certain points during execution, when you might hit a breakpoint in the right function, for example.

 

Of course, we could continue allowing all expressions entered at edit time, and only disallow new watch expressions that do not compile correctly in the scope in which the program is suspended, but I think that would be confusing, and it would probably also be a hindrance to many users.

 

The fact that (in my opinion, at least) it causes no great harm to enter  an expression with a typo makes me very reluctant to remove useful behavior simply to avoid that possibility.

 

Luis

0 Kudos
Message 5 of 8
(4,497 Views)

Hi Luis,

 

I am sorry but I didn't fully get your point... The watch feature is supposed to monitor valid C expressions, i.e. variables, no? Because you can not assign a value to a brace or a semicolon, monitoring the value of a semicolon or brace does not seem to make much sense for me. As mentioned above, I missed your argument 😞

 

As pointed out by Jochen, this is certainly not the most urgent thing to address and I could arrange with this (funny) behavior.

 

Wolfgang

0 Kudos
Message 6 of 8
(4,490 Views)

I'm sorry, I should have been clearer.

 

What I meant to say is that CVI does not compile watch expressions until the moment when you are debugging your project and you stop at a breakpoint. Because most watch expressions use variables from your program, and those variables are only meaningful in specific scopes within your program, the compilation of a watch expression often fails. And that's okay. We don't want the failure to compile a watch expression to cause the expression to be rejected as invalid, since it might be invalid at a particular point in time, but become valid later on.

 

I understand that you are thinking of scenarios where the expression would always be invalid -- for instance, if there were a missing brace, or a missing parenthesis. But in order to detect those errors, the expression still has to be put through the compiler. And while we could conceivably examine the compiler output to differentiate between the "unknown identifier" type of errors versus the invalid syntax errors, pretty soon this would become a real mess. For example, if we don't know the data types of the identifiers, we also won't be able to detect many syntax errors involving those identifiers. Expressions containing items such as **myVar or myVar->x might or might not be syntactically correct depending on the data type of myVar. It would just be way too messy, and also confusing to users for CVI to allow some of these types of errors but not others.

 

Luis

0 Kudos
Message 7 of 8
(4,456 Views)

Hi Luis,

 

Probably I was too tired yesterday, now I got it - thanks for elaborating!

0 Kudos
Message 8 of 8
(4,450 Views)