comparison include/SDL_types.h @ 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 f6ffac90895c
children 1ea658a3dd52
comparison
equal deleted inserted replaced
462:1be0cdaf8092 463:bf7389310d27
82 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); 82 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
83 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); 83 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
84 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); 84 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
85 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); 85 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
86 86
87 /* Check to make sure enums are the size of ints, for structure packing.
88 For both Watcom C/C++ and Borland C/C++ the compiler option that makes
89 enums having the size of an int must be enabled.
90 This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
91 */
92 typedef enum {
93 DUMMY_ENUM_VALUE
94 } SDL_DUMMY_ENUM;
95
96 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
97
87 #undef SDL_COMPILE_TIME_ASSERT 98 #undef SDL_COMPILE_TIME_ASSERT
88 99
89 /* General keyboard/mouse state definitions */ 100 /* General keyboard/mouse state definitions */
90 enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 }; 101 enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 };
91 102