annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

It has been a while since I've written code in "C"

YUP,  I'm at a loss

 

Essentially, I found--

 Main()

Init ()

While(1)

}

Clean-up()

 Unreachable code(????)

"1" sort-of "IS" doesn't it?  how do you reach the "Clean-up()"?


"Should be" isn't "Is" -Jay
0 Compliments
Message 1 sur 15
11 824 Visites

There could be some "break" command in the loop, or even better: goto 😄

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Compliments
Message 2 sur 15
11 799 Visites

When it comes to Booleans, 0 is FALSE, everything else is a TRUE.  But I do see that you are missing the open bracket for the WHILE.

 

Watch out for Breaks.  The C developer I inherited a lot of bad code from loved the Break.  Also watch for a Try...Catch.  They might be depending on an error to break out of the loop.



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 Compliments
Message 3 sur 15
11 791 Visites

There are no gotos and no breaks

 

No returns

 

just nice clean-up code that can't be executd while the univere has unity.


"Should be" isn't "Is" -Jay
Message 4 sur 15
11 777 Visites

Jeff·Þ·Bohrer wrote:

just nice clean-up code that can't be executd while the univere has unity.


Good thing we've never seen people do that in LabVIEW...



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
Message 5 sur 15
11 770 Visites

@crossrulz wrote:

Jeff·Þ·Bohrer wrote:

just nice clean-up code that can't be executd while the univere has unity.


Good thing we've never seen people do that in LabVIEW...


Ctrl+. (Period) exists in LabVIEW so its not exactly the same.  and do you have down stream code when you use that construct?

 

Reminds me of a movie I saw

 


"Should be" isn't "Is" -Jay
0 Compliments
Message 6 sur 15
11 760 Visites

Jeff·Þ·Bohrer wrote:

Ctrl+. (Period) exists in LabVIEW so its not exactly the same.  and do you have down stream code when you use that construct?


I found a post this morning that had the infinate loop and then cleanup code afterwards.  Oh, and it ran on RT.  I have since deleted it and I don't feel like finding it again.



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
Message 7 sur 15
11 751 Visites

@JÞB wrote:

Ctrl+. (Period) exists in LabVIEW so its not exactly the same.  and do you have down stream code when you use that construct?

 

Reminds me of a movie I saw

 


Doesn't always work though. 

Found a case where the producer loop stopped, leaving the consumer waiting... and waiting... and waiting... Ctrl-period did nothing.

There's probably other poorly-coded problems in that project too... :uhoh

0 Compliments
Message 8 sur 15
11 726 Visites

Oh sure, CTRL + . doesn't always do what you want.  Here is a fun one.  Create a subVI that has the window appearance setup to be a dialog which a modal display.  Then place that subVI in a main VI in a case structure, in a while loop.  Add a boolean control set to false on the case selector, and have the model dialog subVI in the true case.  Then open the front panel on both VIs before running the main. (with a constant on the while loop to not stop).

 

What do you get?  Well the model dialog is in memory so it is shown, and it is model so it is brought forward.  But it never is running so CTRL . won't stop it.  Also being model you won't be able to click into the Main to stop it, or CTRL . into the main.

 

The solution?  Task kill LabVIEW, or use some kind of Abort All similar to this one.

 

http://lavag.org/files/file/117-abort-vi/

Message 9 sur 15
11 714 Visites

CRTL + . does not work on VIs which do not have an abort button. It also does not work on modal VIs. There may be other combinations as well.

 

The Help page for keyboard shortcuts does not mention these limitations.

 

Lynn

Message 10 sur 15
11 705 Visites