Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5339

Local Variable Initialization (variable possibly uninitialized, but it is initialized?)

$
0
0

I am having very bizzare behavior with my code. Some error messages complaining about referencing uninitialized variables led me to search around and I discovered that the shareware I am using has very little initialization of local variables. CVI gives compiler warnings about these variables, and I do not think it caught even close to all of them. So I went through the entire file and initialized everything myself.

 

Even after I initialize my variables though, the compiler still says they are unitialized, and my code still fails. I have attached a screen of the compiler warnings along with one of the problem functions. Notice that in the first warning ( 36, 9 warning: variable '(*tw1).i' is possibly uninitialized when used here ) it has two notes under it, one that tells me where the variable is declared and one that says "1, 1 note: add initialization to silence this warning". When I double-click on this note it points to the top of the file, as if it is telling me to initialize the variable outside of the function.

 

I also found a very simlar post on this but the user said they were defining the same structure twice.

http://forums.ni.com/t5/LabWindows-CVI/Local-array-initializations-not-recognized/m-p/2638119/highlight/true#M64744

 

Also, I understand that in the screenshot I have not yet initialized the members of my structure, which I plan on doing once I get rid of these warnings.

 

What must I do to remove this error? Any help is greatly appreciated, I've been messing around with this for too long. Thank You!


Viewing all articles
Browse latest Browse all 5339

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>