---
name: "SDL_size_add_check_overflow"
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_size_add_check_overflow"
---

# SDL\_size\_add\_check\_overflow(3)

Add two integers, checking for overflow.

## NAME

SDL\_size\_add\_check\_overflow - Add two integers, checking for overflow.

## HEADER FILE

Defined in SDL3/SDL\_stdinc.h

## SYNOPSIS

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

**SDL\_FORCE\_INLINE bool SDL\_size\_add\_check\_overflow(size\_t a, size\_t b, size\_t \*ret);**

## DESCRIPTION

If **a**+**b** would overflow, return false.

Otherwise store **a**+**b** via ret and return true.

## FUNCTION PARAMETERS

- *a*

  the first addend.

- *b*

  the second addend.

- *ret*

  on non-overflow output, stores the addition result, may not be NULL.

## RETURN VALUE

Returns false on overflow, true if result is added without overflow.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.
