04-16-2015 05:17 AM
You should be aware that tunnels are only a special case of a general rule, which is that "undefined" outputs will return the default value for the data type. This applies to things like USRs (which start out with the default, as that link shows) indexing past the end of an array, tunnels defined to use default if unwired (although that's explicit), outputs on nodes which don't execute because of errors, etc. I don't think that this is written anywhere, and I don't think it's even technically an absolute rule, but in practice that is the way LV behaves. It would be nice to have it officially documented, but I would suggest it's the kind of thing which you should generally not rely on (although there are exceptions).
04-16-2015 10:58 AM
@Bokor wrote:
Formally speaking this help talks about shift registers and not tunnels.
But since the behaviour is clear, I stop beating a dead horse 🙂
And yes, calling the support is also an option. I should find my code somewhere 😉
Have a nice day everybody!
Oops, you're absolutely correct. I just think of them as the same thing because I'm constantly converting tunnels into shift registers.
04-16-2015 11:07 AM
@tst wrote:
You should be aware that tunnels are only a special case of a general rule, which is that "undefined" outputs will return the default value for the data type. This applies to things like USRs (which start out with the default, as that link shows) indexing past the end of an array, tunnels defined to use default if unwired (although that's explicit), outputs on nodes which don't execute because of errors, etc. I don't think that this is written anywhere, and I don't think it's even technically an absolute rule, but in practice that is the way LV behaves. It would be nice to have it officially documented, but I would suggest it's the kind of thing which you should generally not rely on (although there are exceptions).
I think it actually has to be something close to, if not completely, an absolute rule. IMHO anything else would make LabVIEW dangerously inconsistent. BUT that is why I always make sure there is a value chosen by me for each case of a case structure for, unless I truly know that I don't (and won't ever) care what the value is for each undefined case. And that's hardly ever.
04-16-2015 11:49 AM
I totally agree with your opinion AltenBach.
I can't imagine who wrote this stuff.
It is as if it were translated from Chinese to English!
The help file is full of these kinds of confusing statements.
04-16-2015 12:42 PM
@AKA_TG wrote:
I totally agree with your opinion AltenBach.
I can't imagine who wrote this stuff.
It is as if it were translated from Chinese to English!
The help file is full of these kinds of confusing statements.
Agreed, but it's full of really good stuff, too. 🙂
03-18-2022 02:44 AM
Here's an elaboration on the "Default value output of for loop N=0" theme for classes:
Zero Iteration For Loop and class tunnel - bug or feature? - NI Community
03-18-2022 08:08 AM
wiebe@CARYA wrote:
Here's an elaboration on the "Default value output of for loop N=0" theme for classes:
Zero Iteration For Loop and class tunnel - bug or feature? - NI Community
Access denied!
03-18-2022 08:30 AM
wiebe@CARYA wrote:
Here's an elaboration on the "Default value output of for loop N=0" theme for classes:
Zero Iteration For Loop and class tunnel - bug or feature? - NI Community
That is on the Champion's private board. You might want to just post a summary of the last few posts from that thread.
03-18-2022 09:50 AM - edited 03-18-2022 09:53 AM
@crossrulz wrote:
wiebe@CARYA wrote:
Here's an elaboration on the "Default value output of for loop N=0" theme for classes:
Zero Iteration For Loop and class tunnel - bug or feature? - NI CommunityThat is on the Champion's private board. You might want to just post a summary of the last few posts from that thread.
My bad...
Here's my content (guess I'm allowed to share that):
Note that the N=0 For Loop returns a default object, while the disabled structure returns the default wire type.
The N=0 For Loop and Preserve Run-Time Class do the same...
So if the control input is a Parent.lvclass, and a Child.lvclass is wired to it, the PRC and N=0 FL return a default Child.lvclas, while the DDS returns a default Parent.lvclass.
In the above example, I've used this to detect if an object is the type (e.g. is a child object wired or not).