BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Why some people say Local Variables are bad...


@altenbach wrote:

Scary thing is that everything apparently worked before updating to 64bit windows .... These race conditions can lurk unseen.! 😞


Actually, the logic is there 4 or 5 ways to shut down the loops (That's what makes it so darned confusing)  but those loop timers just leave everything to chance on when data gets to em


"Should be" isn't "Is" -Jay
0 Kudos
Message 351 of 396
(8,304 Views)

@altenbach wrote:

These race conditions can lurk unseen.! 😞


Yeah, I have a customer (used to be coworker) who just upgraded computers on an older test system.  I thought for sure the race conditions in the main VI was going to bite them hard.  Apparently they didn't upgrade enough.


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
Message 352 of 396
(8,301 Views)

After all that the problem moving from 32 bit to a 64 bit system was.....

Spoiler
he deployed an exe to the 64 bit target and thought FP Close would exit the application instance.Smiley Surprised

"Should be" isn't "Is" -Jay
0 Kudos
Message 353 of 396
(8,285 Views)

The start of an abuser, see here

 

Original code:  Oh Boy... I forgot about the snippet creator... should have used code grabber..

 

 

 

Same without Locals

 

 

Download All
0 Kudos
Message 354 of 396
(8,263 Views)

What is even crazier is how he keeps track of the maximum value:

 

As I wrote here:

 

You seem to want to keep track of the maximum value. Also here you are making huge mistakes. First you append the value to the front of an array (which is much less efficient than adding to the end of an array). Then you keep the array in an uninitialized shift register, meaning that you retain old data between runs. Then you are growing the array forever, (or until you run out of memory). All you need to keep is a scalar value containing the current max!

 

Here's my a quick alternative that only needs to keep 8 bytes in memory, as opposed to searching for array max in an evergrowing array.

 

 

Message 355 of 396
(8,256 Views)

There is a new idea out to make local variables "good again", whatever that means.

 

See for yourself and either vote or abstain 😄

 

I will abstain. 😉

Message 356 of 396
(8,163 Views)

Why do we get all these horrible suggestions here?

 

"Wire as many local variables to all the case outputs to as yopu wish to see it blink as the code executes."

 

"Create local variable for all & inside loop make it true & outside make it false"

 

(If the guy would post his actual code, we could turn it into a state machine without any local variables in a few minutes....)

 

 

 

0 Kudos
Message 357 of 396
(8,071 Views)

For some reason I see the guy that posted the Variables Idea having this expression when he was informed about the Declined Status:

http://cdn.memegenerator.net/instances/400x/32647588.jpg

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 358 of 396
(8,055 Views)

Local Horror!!

 

Discussed here

 

The locals span 3 screens down!  The code is incomprehensible..

 

 

0 Kudos
Message 359 of 396
(7,963 Views)

Maybe he loves floating items? 🙂

 

<40 posts to go for 10k heroism!

How long will it take?
A day or 2?

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 360 of 396
(7,953 Views)