Function SDL_zerop

pub unsafe fn SDL_zerop<T>(x: *mut T) -> *mut T
Available on crate feature dep_sdl3 only.
Expand description

Clear an object’s memory to zero, using a pointer.

This is wrapper over SDL_memset that handles calculating the object size, so there’s no chance of copy/paste errors, and the code is cleaner.

This requires a pointer to an object, not an object itself, nor an array.

§Parameters

  • x: a pointer to the object to clear.

§Thread safety

It is safe to call this macro from any thread.

§Availability

This macro is available since SDL 3.2.0.

§See also

  • [SDL_zero]
  • [SDL_zeroa]

§Safety

It must be valid to zero all bytes of T, and it must be valid to write a T to the memory pointed to by x