5 ms·
For reference, they use this code instead of assert: #if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST) # define ALWAYS(X) (1)
by FrozenVoid 7y ago
For reference, they use this code instead of assert:
#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST)
# define ALWAYS(X) (1)
# define NEVER(X) (0)
#elif !defined(NDEBUG)
# define ALWAYS(X) ((X)?1:(assert(0),0))
# define NEVER(X) ((X)?(assert(0),1):0)
#else
# define ALWAYS(X) (X)
# define NEVER(X) (X)
#endif
- bayareanative 7y agoALWAYS and NEVER don't pass-through their values consistently as claimed in debug builds, they pass through truthiness instead, with actual values in release builds. Perhaps this would be better for debug builds: #define ALWAYS(X) (assert(X), (X)) #define NEVER(X) (assert(!(X)), (X))
- pawelmurias 7y agoThat would duplicate X
- ahaferburg 7y agoIn addition to, not instead of.