LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serious bug in LabView 8.5 Formula Node



@rolfk wrote:

In fact there is a bug here since C syntax states that the sequence expression is evaluated from left to right and the last result is the result of the entire expression. LabVIEW does use the first result as result of the entire expression which is not according to the C syntax.


I take it back! There is no bug here! The assignment has a much higher operator precedance than the sequence operator so the 3 is assigned first and then the 14 is evaluated as a separate expression and it's result is discarded.

Writing a=(3,14) would result in a = 14 since the sequence expression is now specifically of higher precedance because of the parentheses.

Rolf Kalbermatter


Message Edited by rolfk on 06-13-2008 09:19 PM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 11 of 13
(819 Views)

rolfk: In fact there is a bug here since C syntax states that the sequence expression is evaluated from left to right and the last result is the result of the entire expression. LabVIEW does use the first result as result of the entire expression which is not according to the C syntax.

Actually, geirove's LabVIEW snippet behaves just as it would in C, at least as far as the assignment goes. In C, the whole expression would be evaluated as 14, but a side effect would be to execute the assignment statement. X (or whatever the name of geirove's variable) would have the value 3 after the expression was evaluated, and that's what happens within the formula node. So as long as NI intended that comma operators in formula nodes should work that way, and documented the behavior properly, there's no bug.

Or do you mean, rolfk, that although LabVIEW is C-like in the way it does the assignment, it's not C-like in evaluating the expression because it incorrectly assigns the value of "x=3" (which is 3) to the expression "X=3,14"? That can't be determined from geirove's example--did you do some other test?

Regards,

--Marty

 


0 Kudos
Message 12 of 13
(783 Views)

Oops, sorry, rolfk, I didn't see your "take back" message before I replied 8-).

--Marty

0 Kudos
Message 13 of 13
(781 Views)