Using offsetof() when available in C++11. Avoids Clang sanitizer complaining about old-style macros. (#94)

This commit is contained in:
omar 2019-08-22 16:55:42 +02:00
parent c4b0bf718a
commit 3fb5cf3541
3 changed files with 7 additions and 2 deletions

View File

@ -39,6 +39,7 @@ Other Changes:
when enabled will have small overlap glitches with (style.Alpha < 1.0).
- TabBar: fixed ScrollToBar request creating bouncing loop when tab is larger than available space.
- TabBar: fixed single-tab not shrinking their width down.
- Using offsetof() when available in C++11. Avoids Clang sanitizer complaining about old-style macros. (#94)
- Backends: DX11: Fixed GSGetShader() call not passing an initialized instance count,
would generally make the debug layer complain (Added in 1.72).
- Backends: Vulkan: Added support for specifying multisample count.

View File

@ -176,7 +176,7 @@ CODE
- When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them.
- Dear ImGui never touches or knows about your GPU state. The only function that knows about GPU is the draw function that you provide.
Effectively it means you can create widgets at any time in your code, regardless of considerations of being in "update" vs "render"
phases of your own application. All rendering informatioe are stored into command-lists that you will retrieve after calling ImGui::Render().
phases of your own application. All rendering information are stored into command-lists that you will retrieve after calling ImGui::Render().
- Refer to the bindings and demo applications in the examples/ folder for instruction on how to setup your code.
- If you are running over a standard OS with a common graphics API, you should be able to use unmodified imgui_impl_*** files from the examples/ folder.

View File

@ -73,8 +73,12 @@ Index of this file:
#define IM_FMTLIST(FMT)
#endif
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR))) // Size of a static C-style array. Don't use on pointers!
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in modern C++.
#define IM_UNUSED(_VAR) ((void)_VAR) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds.
#if (__cplusplus >= 201100)
#define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11
#else
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro.
#endif
// Warnings
#if defined(__clang__)