The question I have is, wouldn't it be faster to have the ALLEGRO_STATE structure inside your function and not push/pop? I can't answer this because I don't know how/if variables are allocated/created/stored/reused inside functions at runtime. But using the push/pop method definitely allocates and deallocates the memory, which I imagine would be the slower option.

So it's assumed that by the time you're ready for release, the asserts will have exposed use-cases (all possible ones, presumably) in your program and thus you disable them in release to improve speed?

So it's assumed that by the time you're ready for release, the asserts will have exposed use-cases (all possible ones, presumably) in your program and thus you disable them in release to improve speed?

Wouldn't it be pretty hard to handle an error caused by miss-use of this stack in run-time anyway?