static_assert.h 383 B

12345678910111213141516171819
  1. #ifndef STATIC_ASSERT_H
  2. #define STATIC_ASSERT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #ifndef STATIC_ASSERT
  7. //Alexandrescu assert
  8. #define STATIC_ASSERT_(X, L) typedef char static_assertion_at_line ## L [(X)?1:-1]
  9. #define STATIC_ASSERT__(X, L) STATIC_ASSERT_(X, L)
  10. #define STATIC_ASSERT(COND, MSG) STATIC_ASSERT__(COND, __LINE__)
  11. #endif
  12. #ifdef __cplusplus
  13. }
  14. #endif
  15. #endif