SDL_const_cast(3)

πŸ’– NAME πŸ’–

  • SDL_const_cast β€” Handle a Const Cast properly whether using C or C++.

okay so bestie, this is SDL_const_cast(3) from the SDL3 FUNCTIONS crew. It's the macro that keeps your const casts from being a whole dramatic situation, whether you're living that C life or serving C++ realness. ✨


✨ SYNOPSIS ✨

First, pull in the header:

#include <SDL3/SDL_stdinc.h>

#define SDL_const_cast(type, expression) const_cast<type>(expression)  /* or `((type)(expression))` in C */

That define is the whole moment. No cap. πŸ’…


🌸 DESCRIPTION 🌸

  • If compiled as C++, this macro offers a proper C++ const_cast<>. C++ bestie, you get the real thing.
  • If compiled as C, this macro does a normal C-style cast. Simple, classic, does the job.
  • This is helpful to avoid compiler warnings in C++. Your build stays cute and your warnings stay quiet. πŸŽ€

πŸŽ€ MACRO PARAMETERS πŸŽ€

  • type β€” the type to cast the expression to.
  • expression β€” the expression to cast to a different type.

πŸ¦‹ RETURN VALUE πŸ¦‹

Returns expression, cast to type. That's the tea. That's the return. 🫢


πŸ‘‘ THREAD SAFETY πŸ‘‘

It is safe to call this macro from any thread. So yes, bestie, go multi-threaded. Main character energy only. πŸ”₯


🌈 AVAILABILITY 🌈

This macro is available since SDL 3.2.0. Mark it in your calendar with a little star. ⭐


πŸ’œ SEE ALSO πŸ’œ


πŸ’– That's the whole page, bestie. It came from Simple Directmedia Layer, version SDL 3.4.18. There's no date in the footer, so we're not making one up. Stay iconic, and may your casts always be const-correct. 🫢✨

πŸ“¦ where this page comes from