Skip to content

Instantly share code, notes, and snippets.

@StarJade-Park
Created November 13, 2019 16:57
Show Gist options
  • Save StarJade-Park/bc54f03af74f5d7f7d2547a2c1bbf051 to your computer and use it in GitHub Desktop.
Save StarJade-Park/bc54f03af74f5d7f7d2547a2c1bbf051 to your computer and use it in GitHub Desktop.
#include <cassert>
#define assert_false assert(false)
#define STATIC_TODO static_assert(false, "TODO")
#ifndef C_PLUS_PLUS_VERSION
#define C_11_UNDER 199711L
#define C_11_AFTER 201103L
#define C_14_AFTER 201402L
#define C_17_AFTER 201703L
#endif // !C_PLUS_PLUS_VERSION
#ifndef UNUSED
#if _MSVC_LANG > C_14_AFTER
#define UNUSED_DEF [[maybe_unused]]
#else
#define UNUSED_DEF
#endif
#define UNUSED(parm) __pragma(warning(suppress:4100 4189)) ((void)(parm))
#endif
#ifndef NULL_CHECK
#define NULL_CHECK(expr) assert(nullptr != expr)
#endif
#ifndef NOT_NULL_CHECK
#define NOT_NULL_CHECK(expr) assert(nullptr == expr)
#endif
#ifndef NULL_CHECK_GET
#define NULL_CHECK_GET(expr) assert(nullptr != expr.get( ))
#endif
#ifndef SIZE_CHECK_ZERO
#define SIZE_CHECK_ZERO(container) assert(0 < container.size( ))
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment