Navigation Menu

Skip to content

Commit

Permalink
Added compile-time checking for the size of enums to SDL_types.h
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 21, 2002
1 parent 36bb48e commit ed27928
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/SDL_types.h
Expand Up @@ -84,6 +84,17 @@ SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
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 */
Expand Down

0 comments on commit ed27928

Please sign in to comment.