Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
SRP_Precompiler code for For Each
I am experiencing crashes using For Each statements in my code. I looked at the pragma output, and I think I found where the errors are occurring.
It looks like the SRP_Precompiler will set up For Each statements with a Common statement for all the common variables necessary to process the loop efficiently. It looks like it places this Common statement only on the first instance of a For Each statement. If that first instance of the For Each statement happens to not run before another instance of a For Each statement then the Common variables are not set up and the program crashes. If this is indeed causing the crash, then I would suggest putting the common statement at the top of the program, before any branching occurs.
It looks like the SRP_Precompiler will set up For Each statements with a Common statement for all the common variables necessary to process the loop efficiently. It looks like it places this Common statement only on the first instance of a For Each statement. If that first instance of the For Each statement happens to not run before another instance of a For Each statement then the Common variables are not set up and the program crashes. If this is indeed causing the crash, then I would suggest putting the common statement at the top of the program, before any branching occurs.
Comments
What I mean is that you are not reporting an issue per se. The original poster reported a crash that was due to a small bug with the SRP Precompiler. You are merely reporting the existence of the SRP Precompiler pragma line.
That said, the SRP Editor will automatically add this line for you if it detects the use of enhanced BASIC+ syntax (like the For Each statement). Are you using enhanced BASIC+ syntax? If not, then I'm not sure why this line got automatically added for you. It won't hurt anything but you might not be able to remove it as long as the SRP Editor thinks it should be there. If you are not expecting it then send me your code so I can identify what might be triggering the auto-add feature of the SRP Editor.