BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Why some people say Local Variables are bad...


Ray.R wrote:

Yes...  There are many pitfalls..  Maybe like you said, we could have a sub forum. However, we would not want to give the idea that LabVIEW has pitfalls..  All programming languages do..  It's the programmers that create the pitfalls... 😉

 

Maybe a sub-forum called "Gatchas"...  LOL!  😄


Good point that.

 

"How not to do it"

_____________________________
- Cheers, Ed
0 Kudos
Message 271 of 396
(8,027 Views)

And now for another example of the pointlessness of the locals:

 

 

The other cases in the event structure are basically the same.

 

from here:http://forums.ni.com/t5/Version-Conversion/Request-to-downconvert-VIs-from-8-5-to-7-1-post-2-2/td-p/...

Message 272 of 396
(7,968 Views)

@smercurio_fc wrote:

from here:http://forums.ni.com/t5/Version-Conversion/Request-to-downconvert-VIs-from-8-5-to-7-1-post-2-2/td-p/...


The correct link is actually here.

 

Even funnier is the timeout case for the UI. It basically tickles most indicators every 100ms. None are connected, because they are all updated via locals elsewhere. Why? Why? Whyyyy? What a waste of CPU cycles. Omitting the timeout case entirely would not change a thing! 😄

 

0 Kudos
Message 273 of 396
(7,953 Views)

Thanks for the link correction, altenbach.

 

Yeah, I got a chuckle out of the Timeout case when I first saw it as well.

0 Kudos
Message 274 of 396
(7,928 Views)
0 Kudos
Message 275 of 396
(7,912 Views)

@nathand wrote:

How about the first frame of this sequence:



Typical text programmers! 😄

 

That almost looks like "Local Variable Russian Roulette"! 😮 (A big step above a simple race condition). For the "Temp data array" we have three readers and four writers nearly concurrently. 

 

You covered the problems nicely in your reply. In addition, I would recommend to transpose before the complex to RE/IM: Only one instance needed.

0 Kudos
Message 276 of 396
(7,944 Views)

Not only was this one a Rube Goldberg example, it is also an example of Locals abuse. Locals as in Local Variables, not people in the vicinity.

 

 

(Seen here)

 

 

Message 277 of 396
(7,852 Views)

More localitis and sequenceitis (as Altenbach put it).

http://forums.ni.com/t5/LabVIEW/String-box-rejects-input-after-built-with-App-Builder/td-p/2017204



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 278 of 396
(7,775 Views)

there is worse than locals... take a look at the VI attached in this posSmiley Surprised


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 279 of 396
(7,765 Views)

@TiTou wrote:

there is worse than locals... take a look at the VI attached in this posSmiley Surprised


My browser's encoding must be off.  I can't understand anything in that post!

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 280 of 396
(7,761 Views)