lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [lucenenet] theolivenbaum commented on pull request #373: Remove delegate based debugging assert
Date Wed, 21 Oct 2020 14:16:26 GMT

theolivenbaum commented on pull request #373:

   Hi @jeme, no worries, I also found the final code a bit confusing. 
   The reason for the redundant check is that I didn't want to change the behavior from:
   **Check Flag** ----> **Check if Assert condition is true** ----> **Throw**
   **Check if Assert condition is true** ----> **Check Flag** ----> **Throw**
   This would happen if we only have the ShouldAssert call - even with the aggressive inlining
option on the ShouldAssert method, the compiler will obviously not invert the checks as that
could change the code behavior.
   if(Debugging.ShouldAssert(*** Some Check ***)){}
   Thus I added back the Debugging.AssertsEnabled check before the call to ShouldAssert to
keep it consistent with the original code, and to avoid the extra checks due to the condition
on every call even when Debugging.AssertsEnabled = false.
   if(Debugging.AssertsEnabled && Debugging.ShouldAssert(*** Some Check ***)){}
   Regarding the interpolated string, true, with the new design where the check for the condition
is outside of the code, that would work fine - I could change it to use the interpolated string
again instead of the new string.Format design...

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:

View raw message