mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Compile-time check for correct padding and alignment in ImVec2
This commit is contained in:
parent
4707b7e732
commit
4b022e571c
1 changed files with 3 additions and 1 deletions
4
imgui.h
4
imgui.h
|
|
@ -76,7 +76,7 @@ Index of this file:
|
|||
// Includes
|
||||
#include <float.h> // FLT_MIN, FLT_MAX
|
||||
#include <stdarg.h> // va_list, va_start, va_end
|
||||
#include <stddef.h> // ptrdiff_t, NULL
|
||||
#include <stddef.h> // ptrdiff_t, NULL, offsetof
|
||||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
||||
|
||||
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
|
||||
|
|
@ -303,6 +303,8 @@ struct ImVec2
|
|||
IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2.
|
||||
#endif
|
||||
};
|
||||
static_assert(offsetof(ImVec2, y) - offsetof(ImVec2, x) == sizeof(float), "Cannot compile ImVec2 due to an alignment/padding violation.\
|
||||
Please reply to (or start) the issue with your compiler version and flags at https://github.com/ocornut/imgui/issues.");
|
||||
|
||||
// ImVec4: 4D vector used to store clipping rectangles, colors etc. [Compile-time configurable type]
|
||||
struct ImVec4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue