avalle Active Member Licensed User Longtime User Apr 13, 2020 #1 I see in the server guide and in most server examples that Code: Copy Private mreq As ServletRequest 'ignore comes with this "ignore" comment. What does ignore mean here? The Handle Sub typically contains the following: Code: Copy Sub Handle(req As ServletRequest, resp As ServletResponse) mreq = req mresp = resp Is there any difference in referring to mreq vs. req or mresp vs. resp? If I need to call a Sub within the same Handler class, which needs to work on the response, is it ok to use the mresp global within the Sub, or instead should I ignore mresp and pass resp as a parameter of the Sub? Code: Copy Sub Handle(req As ServletRequest, resp As ServletResponse) mreq = req mresp = resp MyPrivateSub End Sub Sub MyPrivateSub () mresp.write("Hello!") End Sub Code: Copy Sub Handle(req As ServletRequest, resp As ServletResponse) mreq = req mresp = resp MyPrivateSub(resp) End Sub Sub MyPrivateSub (response As ServletResponse) response.write("Hello!") End Sub Which one is correct: Option 1 or 2? And if Option 1 is fine, why ignore it?
I see in the server guide and in most server examples that Code: Copy Private mreq As ServletRequest 'ignore comes with this "ignore" comment. What does ignore mean here? The Handle Sub typically contains the following: Code: Copy Sub Handle(req As ServletRequest, resp As ServletResponse) mreq = req mresp = resp Is there any difference in referring to mreq vs. req or mresp vs. resp? If I need to call a Sub within the same Handler class, which needs to work on the response, is it ok to use the mresp global within the Sub, or instead should I ignore mresp and pass resp as a parameter of the Sub? Code: Copy Sub Handle(req As ServletRequest, resp As ServletResponse) mreq = req mresp = resp MyPrivateSub End Sub Sub MyPrivateSub () mresp.write("Hello!") End Sub Code: Copy Sub Handle(req As ServletRequest, resp As ServletResponse) mreq = req mresp = resp MyPrivateSub(resp) End Sub Sub MyPrivateSub (response As ServletResponse) response.write("Hello!") End Sub Which one is correct: Option 1 or 2? And if Option 1 is fine, why ignore it?
Erel B4X founder Staff member Licensed User Longtime User Apr 13, 2020 #2 'ignore tells the compiler to ignore warnings on that line. In many cases these global variables are unused so the compiler will show a warning about unused variables. Please ignore the 'ignore. Upvote 0
'ignore tells the compiler to ignore warnings on that line. In many cases these global variables are unused so the compiler will show a warning about unused variables. Please ignore the 'ignore.
avalle Active Member Licensed User Longtime User Apr 13, 2020 #3 Thanks Erel, I didn't know the purpose of the 'ignore comment is to suppress the compiler warning for unused variables. So option 1 is ok, great! Upvote 0
Thanks Erel, I didn't know the purpose of the 'ignore comment is to suppress the compiler warning for unused variables. So option 1 is ok, great!
Erel B4X founder Staff member Licensed User Longtime User Apr 13, 2020 #4 More information here: https://www.b4x.com/android/forum/threads/compiler-warnings.28950/#content Upvote 0