---
name: "SDL_static_cast"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_static_cast"
---

# SDL\_static\_cast(3)

Handle a Static Cast properly whether using C or C++.

## NAME

SDL\_static\_cast - Handle a Static Cast properly whether using C or C++.

## HEADER FILE

Defined in SDL3/SDL\_stdinc.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**#define SDL\_static\_cast(type, expression) static\_cast\<type\>(expression)  /\* or \`((type)(expression))\` in C \*/**

## DESCRIPTION

If compiled as C++, this macro offers a proper C++ static\_cast\<\>.

If compiled as C, this macro does a normal C-style cast.

This is helpful to avoid compiler warnings in C++.

## RETURN VALUE

Returns **expression** , cast to **type** .

## THREAD SAFETY

It is safe to call this macro from any thread.

## AVAILABILITY

This macro is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_reinterpret\_cast**(3)](/SDL_reinterpret_cast/3.md), **•**(3), [**SDL\_const\_cast**(3)](/SDL_const_cast/3.md)
