NI Home > Community > NI Discussion Forums

BreakPoint

Reply
Knight of NI
Knight of NI
Ben
Posts: 16,133
0 Kudos

Re: LabVIEW Minutiae (that may bite you someday)

In this thread Sunflower brings one of the "Bite you" scenarios regarding setting an AE as re-entrant and getting away with it... for now.

 

Ben

Ben Rayner
Who is NOT John Galt... yet... just building Rayner's Ridge
Scheduled to close on the new ridge next week!
Proven Zealot
Jeff·Þ·Bohrer
Posts: 7,685

Re: LabVIEW Minutiae (that may bite you someday)

Casting an int to an Enum (strict).

 

Who thought it would be so tricky?  Turns out that although I had expected each of the last 4 methods to be functionally equvellent I was wrong. 

I guess you really do learn something new every day.

Cast to Enum.png

 

8-Ball Consulting advertising banner

Certified LabVIEW Consultant. The partner you can bank on when you're behind the 8-ball.
Active Participant
jcarmody
Posts: 1,939

Re: LabVIEW Minutiae (that may bite you someday)

Make that constant into a U16 and Bob will be your uncle.

Jim

You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
Active Participant
jcarmody
Posts: 1,939

Re: LabVIEW Minutiae (that may bite you someday)

This NI document explains typecasting an integer into an enum.

Jim

You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
Proven Zealot
Jeff·Þ·Bohrer
Posts: 7,685
0 Kudos

Re: LabVIEW Minutiae (that may bite you someday)

Just when I thought I knew something about LabVIEW!

 

Thanks Jim!  I wondered WHY- now I know.

8-Ball Consulting advertising banner

Certified LabVIEW Consultant. The partner you can bank on when you're behind the 8-ball.
Active Participant
paulmw
Posts: 415
0 Kudos

Re: LabVIEW Minutiae (that may bite you someday)

Jeff, you'd might like this too.

 

Coerce to Type

Active Participant
RobCole
Posts: 573

Re: LabVIEW Minutiae (that may bite you someday)

Here is one that I also consider bad programming practice.

 

Default Enums

 

Setting a typedef enum as Use Default If Unwired always returns the FIRST (lowest number) in the enum. If you right click and create a constant, you will get whichever state was set to Make Current Value Default. This may be different from what the output is when left unwired. The default state is not shown and you have to look at the typedef to find out which will be the output.

 

Related - if someone rearranges the typedef enum (moves some other text to the first element) then the output of the unwired terminal changes. The state when you create a constant does not.

 

I think I would prefer a "Create Constant in Unwired Cases" option to use here.

 

     Rob

Trusted Enthusiast
SteveChandler
Posts: 2,250
0 Kudos

Re: LabVIEW Minutiae (that may bite you someday)

You have a value changed event for a combo box with Allow Undefined Strings deselected. You try to enter an invalid string into the combo box the system beeps an error at you and the control is not updated. As soon as you click somewhere else on the FP but the value changed event fires anyway. If you press escape prior to clicking away from the control the event is not fired.

 

Bug or intended behavior?

 

See this thread for more info.

=====================
LabVIEW 2012


Trusted Enthusiast
SteveChandler
Posts: 2,250
0 Kudos

Re: LabVIEW Minutiae (that may bite you someday)

 


SteveChandler wrote:

 

See this thread for more info.


Grr... It is early and I ran out of time to edit. The link points to the right thread but the wrong post. Just scroll up and see the first post. Anyway...

 

=====================
LabVIEW 2012


Knight of NI
Knight of NI
Ben
Posts: 16,133

Re: LabVIEW Minutiae (that may bite you someday)

When working with the 3D Graph in the 3D Picture, I got bit.

 

A is not equal to B

 

Not_The_Same.JPG

 

Since I cut-n-pasted from an example I ASSumed that the wire was run behind the structure and worked with the value from "A" right up until I tested it.

 

Please note the tiny arrows indicating an Input AND an Output.

 

Can anyone else recall seeing another one these anywhere else?

 

 

Ben

Ben Rayner
Who is NOT John Galt... yet... just building Rayner's Ridge
Scheduled to close on the new ridge next week!