changeset 463:bf7389310d27

Added compile-time checking for the size of enums to SDL_types.h
author Sam Lantinga <slouken@libsdl.org>
date Wed, 21 Aug 2002 04:16:31 +0000
parents 1be0cdaf8092
children 1c4be4a16410
files include/SDL_types.h
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/include/SDL_types.h	Tue Aug 20 16:58:49 2002 +0000
+++ b/include/SDL_types.h	Wed Aug 21 04:16:31 2002 +0000
@@ -84,6 +84,17 @@
 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
 
+/* Check to make sure enums are the size of ints, for structure packing.
+   For both Watcom C/C++ and Borland C/C++ the compiler option that makes
+   enums having the size of an int must be enabled.
+   This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
+*/
+typedef enum {
+	DUMMY_ENUM_VALUE
+} SDL_DUMMY_ENUM;
+
+SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
+
 #undef SDL_COMPILE_TIME_ASSERT
 
 /* General keyboard/mouse state definitions */