[SDL] SDL2 (latest hg, as of this morning) error in my application

Nathaniel J Fries nfries88 at yahoo.com
Fri Mar 15 10:08:32 PDT 2013


An issue of C++ implementing its own versions of C functions for const-correctness.

Just cast the result of strchr using a simple C-style cast.

Example:

Code:

- SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return strrchr(str, c); }
+ SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return (char *)strrchr(str, c); }




(the C++ "correct" way would be using const_cast; but C then you've got to create two versions of the functions, which is a fairly pointless endeavor).

------------------------
Nate Fries




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130315/cc78c74e/attachment-0009.htm>


More information about the SDL mailing list