LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close reference, write to reference, close reference--Redundant?

Hello,
 
I am analyzing another's code, and came upon this snippet:
 
[Text reference in] --> Close Reference [Reference out]
--> [Text string in] Write to Text File [Reference out]  -->  Close reference
 
Thoughts?
 
 
Thanks for your time.
0 Kudos
Message 1 of 3
(2,475 Views)
From your description, it sounds like at least one of the reference close operations are redundant - it's hard to tell exactly. However, operationally it shouldn't cause too much mischief as redundant or unneeded reference closings compile to a noop instruction.
 
Mike..

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 3
(2,471 Views)
This should throw an error.  Once you call the first Close Reference.vi, the reference is invalid and deallocated in memory.  Trying to use the reference again by either writing to the file or closing the reference again will cause an error. 

In general, it it not good programming practice to split a reference wire.  This code has branched the wire somewhere otherwise it would be impossible to use the reference after it has been closed.  This is why there isn't a reference out on a close reference.
Message 3 of 3
(2,445 Views)