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

Sam Lantinga slouken at libsdl.org
Fri Mar 15 11:58:48 PDT 2013


Fixed, thanks!

On Fri, Mar 15, 2013 at 10:08 AM, Nathaniel J Fries <nfries88 at yahoo.com>wrote:

> **
> 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
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130315/d43bbb59/attachment-0009.htm>


More information about the SDL mailing list