From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Why some people say Local Variables are bad...

There was a discussion in one thread where there seemed to be 2 camps.  One insisting that Locals were okay... and they are as long as they are carefully utilised, and the other saying that it is better to stay away from Locals, because most people abuse them considerably.
 
This thread is to tally all examples posted on this forum where Locals are either abused, misused, or caused headaches..  A Rube Goldberg cousin dedicated to Locals..  and the occasional Globals.. 
 
Please post examples and links.  
Message 1 of 395
(22,335 Views)

Let's start with this first example.

Thanks to smercurio for posting this reply.

 

Message 2 of 395
(22,333 Views)
Message 3 of 395
(22,318 Views)

Dear JLV,

shall we post 'global' headaches also Smiley Surprised ???? Smiley Wink

Thanks,

Mathan

0 Kudos
Message 4 of 395
(22,314 Views)

Here is a nice tutorial.... njoy

Thanks,

Mathan

0 Kudos
Message 5 of 395
(22,311 Views)

Reverse programming (right-to-left) can be even more confusing with Locals!

See this link.

Mathan, yes Globals are okay 😉

Message 6 of 395
(22,287 Views)

Something seen often... Using Locals to write to itself: 

And of course, there is a race condition in (C); values in the case structure vs out.



Message Edited by JoeLabView on 05-22-2008 12:30 PM
Message 7 of 395
(22,282 Views)

Example of why 18 frame stacked sequence with frames linked via sequence locals and local variables is a nightmare for code maintenance:

Discussed here

Message 8 of 395
(22,277 Views)
Message 9 of 395
(22,274 Views)