changeset 4233:48e63c07bbbf SDL-1.2

Added cast macros so SDL_net will compile with SDL 1.2
author Sam Lantinga <slouken@libsdl.org>
date Tue, 22 Sep 2009 04:35:46 +0000
parents 29605c881b29
children 9cb722ce769c
files include/SDL_stdinc.h
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 {