If you’re like some coders you like to have “clean” compiles
No warnings. No errors. Nothing.
So when a new one does popup you can inspect it, fix it, and return to a pristine state. Its one way to make sure new issues dont crop up very earliy in your work cycle.
Often you get a lot of “Unused event parameter” or “Unused method parameter” warnings.
And it can be tedious to go back and insert a pile of #Pragma Unused for each one.
But did you know that you could just write those pragmas right at the outset and tell the compiler that every parameter will be unused ? And that it really wont matter ?
Suppose you write a new method like
Sub foo( bar as integer, baz as color, foobar as string) End Sub
If you now do a check project you will get warnings that the parameters are unused
So if you dutifully enter
#Pragma unused bar #Pragma unused baz #Pragma unused foobar
and redo your check and things are clean again. Now, what if you alter the code to actually use one of those parameters ? Do you need to remove the #pragma ? Doesn’t that #pragma flag the variable as “unused” in a way the compiler will now complain about you saying it was unused but you’ve now gone & used it ?
In fact the answer is no – what that pragma does is mark that variable as USED so the compiler will stop complaining about it being unused. (Cute isnt it ?)
You can leave those pragmas in place and use the variable and NOT mess up anything.
So you might consider writing the pragmas at the time you implement the event or method and never get warnings about unused parameters ever again 🙂
Or just turn those warnings off 🙂