Jump to content

Commenting Code


Recommended Posts

QUOTE(tcplomp @ Jun 28 2007, 12:00 PM)

Another project specific structure I use frequently is the conditional disable structure, also located in the structures pallete. This one allows you to turn on and off behavior similar to #ifdef's in C by setting a variable in the project manager. An example is one that I use all the time: HARDWARE=TRUE/FALSE :thumbup: Makes development at my desk a much happier experience.

Or another one I see frequently is: DEPLOY=TRUE/FALSE for enabling autoclose behavior or things that you just want to happen after you build the EXE.

Link to comment

QUOTE(orko @ Jun 28 2007, 11:21 PM)

Another project specific structure I use frequently is the http://zone.ni.com/reference/en-XX/help/371361B-01/glang/conditional_disable_structure/' target="_blank">conditional disable structure, also located in the structures pallete. This one allows you to turn on and off behavior similar to #ifdef's in C by setting a variable in the project manager. An example is one that I use all the time: HARDWARE=TRUE/FALSE :thumbup: Makes development at my desk a much happier experience.

Or another one I see frequently is: DEPLOY=TRUE/FALSE for enabling autoclose behavior or things that you just want to happen after you build the EXE.

DEBUG==TRUE

Ton

Link to comment
  • 2 weeks later...

Prior to the diagram disable and conditional disable structures in 8.2, you could just drop a case structure and wire a constant to the ? input. This wasn't a complete commenting out -- if you had a broken wire inside the case structure, your VI was still broken, unlike the new diagram/conditional disable structures. But it did guarantee that code would not execute. That trick still works in 8.2, but the new strutures, as I mentioned, do a more thorough commenting out.

Link to comment

QUOTE(Aristos Queue @ Jul 9 2007, 05:26 PM)

That trick still works in 8.2, but the new strutures, as I mentioned, do a more thorough commenting out.

Also, 8.2 and later now remove code like this when you build the application, so you can't use this to hold VIs in memory. I assume the same happens with the disable structures, but I'm not sure.

Link to comment
QUOTE(yen @ Jul 9 2007, 12:43 PM)
Also, 8.2 and later now remove code like this when you build the application, so you can't use this to hold VIs in memory. I assume the same happens with the disable structures, but I'm not sure.
True. The diagram disable structures do not hold VIs in memory. If you need to hold subVIs in memory without invoking them, use the Static VI Reference node (found in the Programming>>Application Control palette).
Link to comment

QUOTE(Aristos Queue @ Jul 9 2007, 07:26 AM)

Prior to the diagram disable and conditional disable structures in 8.2, you could just drop a case structure and wire a constant to the ? input. ... That trick still works in 8.2...

Just for completeness, I want to remind people that if you use a case structure to comment out code AND you still want it to stay in memory, you now need to use a boolean control on the front panel set to false instead of a boolean constant. The LabVIEW compiler is smarter now and will not include code if it's inside a case structure with a boolean constant set to false.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.