Closed ChasonTang closed 3 years ago
@ChasonTang The existing logic and read-write lock of this module can ensure that the problems you imagine will not occur. If it does happen, it should be fixed instead of adding such a test and assertion.
In addition, it is generally unacceptable to call assert
directly in an SDK used online.
Thanks for your review. It's true that it should be fixed when it does happen.But it is not test and assert.It is defensive programming.It is potentially result If you change the module logic that effect this code.Assert can alert it in Debug mode and become NO-Op in release mode(-DNDEBUG that will be made in NDK toolchain) Assert can still be used in online SDK. assert aborts the process, but is turned into a no-op when the program is compiled with -DNDEBUG. It should be only used to check for situations that "can't happen"
clang analyzer output as below