Переглянути джерело

Add a test to verify structure alignment

Sam Lantinga 7 місяців тому
батько
коміт
04a732881a
1 змінених файлів з 6 додано та 0 видалено
  1. 6 0
      include/SDL3/SDL_stdinc.h

+ 6 - 0
include/SDL3/SDL_stdinc.h

@@ -494,6 +494,12 @@ SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
+typedef struct SDL_alignment_test
+{
+    Uint8 a;
+    void *b;
+} SDL_alignment_test;
+SDL_COMPILE_TIME_ASSERT(struct_alignment, sizeof(SDL_alignment_test) == (2 * sizeof(void *)));
 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
 /** \endcond */