BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Why some people say Local Variables are bad...

There's more code.  It's all Locals.  I only posted one Event Case.
 
The Stop Scan won't be doing much either since it's outside both loops.


Message Edited by JoeLabView on 07-07-2008 10:13 AM
Message 51 of 396
(13,959 Views)
If the Stop Scan button is pressed while the innermost loop is running, it will stop the loop.  However, the outer loop has already seen Stop Scan as not being pressed, so it will kick off another inner loop.  This will execute one more time than probably what was intended.  I'm assuming that the mechanical action is not a latch because of the local variables.  If it were a latch, it would be reset as soon as the inner loop reads it and the program would never stop.
- tbob

Inventor of the WORM Global
Message 52 of 396
(13,910 Views)

Very well explained tbob..  🙂

Not speaking from experience..  Of course... such a thing has never happened to us (even a long time ago), right?

cough... cough...

😉

0 Kudos
Message 53 of 396
(13,896 Views)

Not an abuse...  and not a Local..

But Shift Registers would be more appropriate than using Global Variables

0 Kudos
Message 54 of 396
(13,858 Views)

 

Smiley Surprised

Actually its more serious that that. There is no guarentte that the lock-press will be set before the seq frame. Even if LV compiles the code such that it does set that flag before the seq today, a re-compile could result in LV changing the order such that the flag does not get set. Smiley Mad

Judging by the names used, that could be a serious safety issue.

In which thread did you find that image? I feel obligated to warn them.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 55 of 396
(13,855 Views)
Oops... I should have posted that.  Lemme look for it.
 
(see it is good that we have this thread) 😉
0 Kudos
Message 56 of 396
(13,826 Views)

Thank you Ray,

It looks like Gerd is already on it.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 58 of 396
(13,819 Views)
yes... and the code underwent further improvements.
0 Kudos
Message 59 of 396
(13,805 Views)
Slight abuse where wires would do the trick
 
 
 
Improved by smercurio:
 


Message Edited by JoeLabView on 07-12-2008 10:54 AM
Message 60 of 396
(13,769 Views)