How to read sdl3 assertion report
10:14 07 Jan 2026

SDL3 provides assertion reports. They store the relevant data, when an assertion fails.

I am trying to print these out at the end of my program. I am following this example from the SDL3 documentation. I've implemented it like this in my program:

const SDL_AssertData* item = SDL_GetAssertionReport();
while(item){
    SDL_Log("Assertion: '%s' failed in %s (%s:%d) %u times",
    item->condition, item->function, item->filename, item->linenum, item->trigger_count);
    item = item->next;
}

To test it, I asserted SDL_assert(1 == 2) above. It didn't print anything out.

I read here, that assertions are automatically removed from the code, when the assertion level isn't high enough. But I compile my program with the (gcc) -Og optimization level and even have the DEBUG_INVOCATION macro set to 1, so I don't think that is the problem.

I am also a little confused about how the data is supposed to be read. The assertion data is stored in a linked list. The first member of an element is the flag always_ignore according to this. Isn't that what is read with the line while(item) ? And if so, shouldn't this always be true and result in an infinite loop, because I am pretty sure, I read somewhere, that the environment variable SDL_ASSERT is set "ignore" on default and I am guessing it controls this member. Btw I am also confused about SDL_ASSERT , because when I set it to "abort" my program doesn't terminate on a failed assertion. This environment variable doesn't have it's own documentation page yet. I read about here.

I am using SDL version 3.4.0 if that is relevant.

c assertion sdl-3