Skip to content

Commit be05e12

Browse files
committed
Misc: Using static_assert() when using C++11, instead of our own construct (avoid zealous Clang warnings).
1 parent b23dcab commit be05e12

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Other Changes:
7777
- Error handling: Assert if user mistakenly calls End() instead of EndChild() on a child window. (#1651)
7878
- Misc: Optimized storage of window settings data (reducing allocation count).
7979
- Misc: Windows: Do not use _wfopen() if IMGUI_DISABLE_WIN32_FUNCTIONS is defined. (#2815)
80+
- Misc: Using static_assert() when using C++11, instead of our own construct (avoid zealous Clang warnings).
8081
- Docs: Improved and moved FAQ to docs/FAQ.md so it can be readable on the web. [@ButternCream, @ocornut]
8182
- Docs: Added permanent redirect from https://www.dearimgui.org/faq to FAQ page.
8283
- Demo: Added simple item reordering demo in Widgets -> Drag and Drop section. (#2823, #143) [@rokups]

imgui_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
155155
#define IM_NEWLINE "\n"
156156
#endif
157157
#define IM_TABSIZE (4)
158+
#if (__cplusplus >= 201100)
159+
#define IM_STATIC_ASSERT(_COND) static_assert(_COND, "")
160+
#else
158161
#define IM_STATIC_ASSERT(_COND) typedef char static_assertion_##__line__[(_COND)?1:-1]
162+
#endif
159163
#define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose
160164
#define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255
161165
#define IM_FLOOR(_VAL) ((float)(int)(_VAL)) // ImFloor() is not inlined in MSVC debug builds

0 commit comments

Comments
 (0)