MrDeathStar Posted June 29, 2015 Share Posted June 29, 2015 My C++ background got the better of me today as I found a silly issue with my sequence code not working because I was using 'private' variables incorrectly with regards to scope. The dynamic strength of DAQFactory allows private sequence variables, once executed, to be available until the sequence ends (in any block, not just for the local code block scope). In my case, I had declared an uninitialized private variable in a while loop which conditionally appends arrays to the variable. At the end of the loop, the arrays (if any) are processed. I incorrectly assumed the private variable was reset empty with each loop interation. I found that using arrayVar.ClearHistory(), even though the variable is not a channel, resolves my issue...it that a valid/preferred way to reset a variable? Link to comment Share on other sites More sharing options...
AzeoTech Posted June 29, 2015 Share Posted June 29, 2015 You can do that, or just do: arrayVar = null Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.