LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to 'comment' out code?

Pana-man,

If you have code you want to be able to select at run-time, then it MUST be compilable.  Therefore, there's noone stopping you wrapping a normal case statement around it and toggling it at run time.

The "Comment" structure is really only of great advantage when the code in question is not functioning (I think we all agree on this).  In this case, you can't swap functioning code for non-functioning code at run-time, so it kind of makes the discussion superfluous.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 21 of 39
(2,791 Views)

Hi

I'm really happy about this new function.

As Shane said, if something should be selectable the "good old" case structure is the way to go. In most applications I write, I dynamically read the type of environment (run-time or LV-IDE). Depending on the result, I execute some code or I do not.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 22 of 39
(2,782 Views)
I guess we can agree to disagree.  I am not talking about trying to switch in broken code that I did not complete.  I am talking about toggling the setting in the project build such that when I run on a test system, certain functions are enabled, but when running on a desktop, some VIs may become broken or cause my app not to run because I do not have the toolkit, equipment, support VIs etc. 
I guess I should be more clear.  This toggle would be set when I build the application or deploy to target to discard functionality that I may want for development or debug but not for application.  Additionally, I can use this to discard code that is not applicable to certain targets when deploying to those targets even in the edit environment. 
This is handled in the project window with conditional disable symbols catagory in project properties.  I can also specify based on creation of targets in the project!  This is of great advantage to 'lighten' applications for run time deployment. 
And as I said to start with, can be very powerful...much more than just commenting out bad code!

Paul
0 Kudos
Message 23 of 39
(2,777 Views)

This toggling you mention is exactly what I meant before. You can also decide to activate code by reading a configuration file or, as I do it, if the app is started in the IDE I bring up a message box to select if some vi should be executed or not. So in a textual language my code would look like this:

if(app.kind == development){
  if(messagebox == execute){
 
  }
}

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 24 of 39
(2,769 Views)

 

Message Edited by becktho on 10-06-2005 04:06 PM

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 25 of 39
(2,770 Views)

This toggling you mention is exactly what I meant before. You can also decide to activate code by reading a configuration file or, as I do it, if the app is started in the IDE I bring up a message box to select if some vi should be executed or not. So in a textual language my code would look like this:

if(app.kind == development){
  if(messagebox == execute){
  
  }
}

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 26 of 39
(2,772 Views)

This toggling you mention is exactly what I meant before. You can also decide to activate code by reading a configuration file or, as I do it, if the app is started in the IDE I bring up a message box to select if some vi should be executed or not. So in a textual language my code would look like this:

if(app.kind == development){
  if(messagebox == execute){
    run vis
  }
}

Thomas

Message Edited by becktho on 10-06-2005 04:06 PM

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 27 of 39
(2,777 Views)

wow - there's something strange going on.

just wanted to submit a message and out of a sudden there are four...

very strange....

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 28 of 39
(2,774 Views)
Pana-man,

I think we're talking about fundamentally different things.

Have a look for "scripting" over at the lava forums.  You'll see that such a case structure exists which is entirely unsupported.  In fact it was only found by "hacking" the development environment.  It allows different code based on OS and so on.  It does exist within LV, but it's currently not opened up for us to exploit.  Yet.

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 29 of 39
(2,803 Views)
Isn't the one included in 8.0 the same as the "hacked" / undocumented version from 7.x?
 
-Khalid
0 Kudos
Message 30 of 39
(2,816 Views)