diff --git a/clay.h b/clay.h index 7bc5e5d..8d49169 100644 --- a/clay.h +++ b/clay.h @@ -112,6 +112,14 @@ static int CLAY__ELEMENT_DEFINITION_LATCH = 0; children \ Clay__CloseElementWithChildren() +#ifdef __cplusplus +#define CLAY__ALIGNMENT(type) alignof(type) +#define CLAY__INIT(type) type +#else +#define CLAY__INIT(type) (type) +#define CLAY__ALIGNMENT(type) (offsetof(struct { char c; type x; }, x)) +#endif + #ifdef __cplusplus extern "C" { #endif @@ -452,14 +460,6 @@ extern uint32_t Clay__debugViewWidth; #define CLAY__MAX(x, y) (((x) > (y)) ? (x) : (y)) #define CLAY__MIN(x, y) (((x) < (y)) ? (x) : (y)) -#ifdef __cplusplus -#define CLAY__ALIGNMENT(type) alignof(type) -#define CLAY__INIT(type) type -#else -#define CLAY__INIT(type) (type) -#define CLAY__ALIGNMENT(type) (offsetof(struct { char c; type x; }, x)) -#endif - bool Clay__warningsEnabled = true; Clay_String CLAY__SPACECHAR = CLAY__INIT(Clay_String) { .length = 1, .chars = " " };