Date: Fri, 18 Feb 2005 20:49:35 +0200 (EET)
authorSam Lantinga <slouken@libsdl.org>
Sun, 29 Jan 2006 23:14:04 +0000
changeset 12941760ceb23bc6
parent 1293 23b1ef7d003b
child 1295 c3e36ac8a94c
Date: Fri, 18 Feb 2005 20:49:35 +0200 (EET)
From: ville
Subject: [SDL] Changing, at least some, anonymous enums to named enums.

Howdy,

Could, some if not all, enums be named rather than being anonymous enums?
I ran into troubles with the enum describing event types in SDL_events.h.
The problem is that an anonymous enum cannot be used in C++ templates like
so:

enum { C };

template< typename T >
void
f( T ) {
}


f( C );
include/SDL_events.h
     1.1 --- a/include/SDL_events.h	Sun Jan 29 23:06:05 2006 +0000
     1.2 +++ b/include/SDL_events.h	Sun Jan 29 23:14:04 2006 +0000
     1.3 @@ -44,7 +44,8 @@
     1.4  #endif
     1.5  
     1.6  /* Event enumerations */
     1.7 -enum { SDL_NOEVENT = 0,			/* Unused (do not remove) */
     1.8 +typedef enum {
     1.9 +       SDL_NOEVENT = 0,			/* Unused (do not remove) */
    1.10         SDL_ACTIVEEVENT,			/* Application loses/gains visibility */
    1.11         SDL_KEYDOWN,			/* Keys pressed */
    1.12         SDL_KEYUP,			/* Keys released */
    1.13 @@ -74,11 +75,11 @@
    1.14  	  It is the number of bits in the event mask datatype -- Uint32
    1.15          */
    1.16         SDL_NUMEVENTS = 32
    1.17 -};
    1.18 +} SDL_EventType;
    1.19  
    1.20  /* Predefined event masks */
    1.21  #define SDL_EVENTMASK(X)	(1<<(X))
    1.22 -enum {
    1.23 +typedef enum {
    1.24  	SDL_ACTIVEEVENTMASK	= SDL_EVENTMASK(SDL_ACTIVEEVENT),
    1.25  	SDL_KEYDOWNMASK		= SDL_EVENTMASK(SDL_KEYDOWN),
    1.26  	SDL_KEYUPMASK		= SDL_EVENTMASK(SDL_KEYUP),
    1.27 @@ -102,7 +103,7 @@
    1.28  	SDL_VIDEOEXPOSEMASK	= SDL_EVENTMASK(SDL_VIDEOEXPOSE),
    1.29  	SDL_QUITMASK		= SDL_EVENTMASK(SDL_QUIT),
    1.30  	SDL_SYSWMEVENTMASK	= SDL_EVENTMASK(SDL_SYSWMEVENT)
    1.31 -};
    1.32 +} SDL_EventMask ;
    1.33  #define SDL_ALLEVENTS		0xFFFFFFFF
    1.34  
    1.35  /* Application visibility event structure */