Add 'nonneg' macro

This commit is contained in:
Daniel Marjamäki 2019-07-14 11:40:44 +02:00
parent 1cadd9398a
commit 36d7e8a361
1 changed files with 10 additions and 0 deletions

View File

@ -62,4 +62,14 @@ inline static int caseInsensitiveStringCompare(const std::string &lhs, const std
#define UNUSED(x) (void)(x)
// Use the nonneg macro when you want to assert that a variable/argument is not negative
#ifdef NONNEG
// Enable non-negative values checking
// TODO : investigate using annotations/contracts for stronger value checking
#define nonneg unsigned
#else
// Disable non-negative values checking
#define nonneg
#endif
#endif