From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compiler is Too Smart for My Own Good

Solved!
Go to solution

@Eric1977 wrote:

I guess this is Stupid Question Time (for me at least)...why aren't you wiring that error wire to the FP.Close Invoke Node?


He wants it to fire regardless of error condition.  Since there is no error input, it will always fire.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 11 of 55
(1,057 Views)

@Eric1977 wrote:

I guess this is Stupid Question Time (for me at least)...why aren't you wiring that error wire to the FP.Close Invoke Node?


Because I want the FP to close even if there's an error.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 12 of 55
(1,056 Views)

@crossrulz wrote:

@billko wrote:

So you're trying to be cute (but also correct) by wiring the reference through the case structure to create an "artificial" dataflow dependency, and the compiler outsmarts you by compiling as if you had the reference wire outside the case structure.  So how did you fix it?  Error cluster inside the case structure going to error in on front panel close?


Synchronize Data Flow.vim could be used (one input being the panel reference, another being the error).


That should be a growable XNode.

"If you weren't supposed to push it, it wouldn't be a button."
Message 13 of 55
(1,054 Views)

@paul_cardinale wrote:

@crossrulz wrote:

@billko wrote:

So you're trying to be cute (but also correct) by wiring the reference through the case structure to create an "artificial" dataflow dependency, and the compiler outsmarts you by compiling as if you had the reference wire outside the case structure.  So how did you fix it?  Error cluster inside the case structure going to error in on front panel close?


Synchronize Data Flow.vim could be used (one input being the panel reference, another being the error).


That should be a growable XNode.


Many would agree with you.

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/The-quot-Zero-Frame-Flat-Sequence-quot-aka-quot-Synch... 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 55
(1,035 Views)

A little offtopic question:

How do I know, how a Labview native Function will react, when an error is wired in?

Do they always do nothing?

0 Kudos
Message 15 of 55
(1,005 Views)

@M.Lichtenheld wrote:

A little offtopic question:

How do I know, how a Labview native Function will react, when an error is wired in?

Do they always do nothing?


In general, you can open the "Help" ("Detailed Help" in the context help window, or "Help" via the right click menu) and then read the "error in" terminal description.

 

Here's a typical example:

error in describes error conditions that occur before this node runs. This input provides standard error in functionality.


The "standard error in" functionality means it does nothing if an error is passed.

 

An alternative example (taken from TCP Close Connection) states:

error in describes error conditions that occur before this node runs. With the following exception, this input provides standard error in functionality.

This node runs normally even if an error occurred before this node runs.

GCentral
Message 16 of 55
(1,001 Views)

This is clearly a bug, right?

Message 17 of 55
(987 Views)

@Intaris wrote:

This is clearly a bug, right?


No.  It's by design.  In general, once an error has occurred, there's no point in performing the rest of the functions; so most functions do nothing if there's an incoming error.  However functions that do things like releasing resources or closing files function even with an incoming error, because you almost certainly want those functions executed regardless of any prior error.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 18 of 55
(965 Views)

Ooh, I disagree completely. LabVIEW has a syntax, and this behaviour violates that syntax without any visual indication of that. Therefore, the BD is lying to us.

 

Compiler optimisations should only offer logical shortcuts, but not anything that actually alters the final result like this. If my code is written as ABCD (using syntax defined by the language), and the order of ABCD is important, no compiler optimisation should override what I, the programmer, has actually formally defined in my code.

 

Really though? Am I the only one who sees this as a clear 100% black and white bug?

 

Are we this far gone?

Message 19 of 55
(962 Views)

@Intaris wrote:

Ooh, I disagree completely. LabVIEW has a syntax, and this behaviour violates that syntax without any visual indication of that. Therefore, the BD is lying to us.

 

Compiler optimisations should only offer logical shortcuts, but not anything that actually alters the final result like this. If my code is written as ABCD (using syntax defined by the language), and the order of ABCD is important, no compiler optimisation should override what I, the programmer, has actually formally defined in my code.

 

Really though? Am I the only one who sees this as a clear 100% black and white bug?

 

Are we this far gone?


When you wrote "This is clearly a bug", you didn't reference anything in particular, so I assumed that you were referring to the previous post (which was about error flow; and clearly that's what I was referring to).  Based on your lasted post, I'm guessing that you are referring to my original post.

 

Actually, it's not uncommon for compilers to rearrange things.  As for the this particular case (reference passed through a structure not enforcing execution order), I'm comfortable calling it either a "bug", or a "quirk".

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 20 of 55
(954 Views)