Added cast macros so SDL_net will compile with SDL 1.2 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Tue, 22 Sep 2009 04:35:46 +0000
branchSDL-1.2
changeset 4233 48e63c07bbbf
parent 4232 29605c881b29
child 4234 9cb722ce769c
Added cast macros so SDL_net will compile with SDL 1.2
include/SDL_stdinc.h
--- a/include/SDL_stdinc.h	Tue Sep 22 02:42:11 2009 +0000
+++ b/include/SDL_stdinc.h	Tue Sep 22 04:35:46 2009 +0000
@@ -78,6 +78,16 @@
 #define SDL_arraysize(array)	(sizeof(array)/sizeof(array[0]))
 #define SDL_TABLESIZE(table)	SDL_arraysize(table)
 
+/* Use proper C++ casts when compiled as C++ to be compatible with the option
+ -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */
+#ifdef __cplusplus
+#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
+#define SDL_static_cast(type, expression) static_cast<type>(expression)
+#else
+#define SDL_reinterpret_cast(type, expression) ((type)(expression))
+#define SDL_static_cast(type, expression) ((type)(expression))
+#endif
+
 /** @name Basic data types */
 /*@{*/
 typedef enum SDL_bool {